aboutsummaryrefslogtreecommitdiff
path: root/appl/ftp
diff options
context:
space:
mode:
Diffstat (limited to 'appl/ftp')
-rw-r--r--appl/ftp/ChangeLog1038
-rw-r--r--appl/ftp/Makefile.am7
-rw-r--r--appl/ftp/Makefile.in916
-rw-r--r--appl/ftp/NTMakefile35
-rw-r--r--appl/ftp/common/Makefile.am14
-rw-r--r--appl/ftp/common/Makefile.in830
-rw-r--r--appl/ftp/common/NTMakefile35
-rw-r--r--appl/ftp/common/buffer.c69
-rw-r--r--appl/ftp/common/common.h60
-rw-r--r--appl/ftp/common/sockbuf.c70
-rw-r--r--appl/ftp/ftp/Makefile.am44
-rw-r--r--appl/ftp/ftp/Makefile.in992
-rw-r--r--appl/ftp/ftp/NTMakefile35
-rw-r--r--appl/ftp/ftp/cmds.c2148
-rw-r--r--appl/ftp/ftp/cmdtab.c203
-rw-r--r--appl/ftp/ftp/domacro.c148
-rw-r--r--appl/ftp/ftp/extern.h174
-rw-r--r--appl/ftp/ftp/ftp.11211
-rw-r--r--appl/ftp/ftp/ftp.c1814
-rw-r--r--appl/ftp/ftp/ftp.cat1658
-rw-r--r--appl/ftp/ftp/ftp_locl.h141
-rw-r--r--appl/ftp/ftp/ftp_var.h130
-rw-r--r--appl/ftp/ftp/globals.c79
-rw-r--r--appl/ftp/ftp/gssapi.c511
-rw-r--r--appl/ftp/ftp/kauth.c57
-rw-r--r--appl/ftp/ftp/main.c590
-rw-r--r--appl/ftp/ftp/pathnames.h44
-rw-r--r--appl/ftp/ftp/ruserpass.c313
-rw-r--r--appl/ftp/ftp/security.c883
-rw-r--r--appl/ftp/ftp/security.h141
-rw-r--r--appl/ftp/ftpd/Makefile.am54
-rw-r--r--appl/ftp/ftpd/Makefile.in1055
-rw-r--r--appl/ftp/ftpd/NTMakefile35
-rw-r--r--appl/ftp/ftpd/extern.h150
-rw-r--r--appl/ftp/ftpd/ftpcmd.c3532
-rw-r--r--appl/ftp/ftpd/ftpcmd.y1478
-rw-r--r--appl/ftp/ftpd/ftpd.8503
-rw-r--r--appl/ftp/ftpd/ftpd.c2367
-rw-r--r--appl/ftp/ftpd/ftpd.cat8309
-rw-r--r--appl/ftp/ftpd/ftpd_locl.h171
-rw-r--r--appl/ftp/ftpd/ftpusers.537
-rw-r--r--appl/ftp/ftpd/ftpusers.cat527
-rw-r--r--appl/ftp/ftpd/gss_userok.c75
-rw-r--r--appl/ftp/ftpd/gssapi.c511
-rw-r--r--appl/ftp/ftpd/kauth.c140
-rw-r--r--appl/ftp/ftpd/klist.c178
-rw-r--r--appl/ftp/ftpd/logwtmp.c199
-rw-r--r--appl/ftp/ftpd/ls.c891
-rw-r--r--appl/ftp/ftpd/pathnames.h63
-rw-r--r--appl/ftp/ftpd/popen.c236
-rw-r--r--appl/ftp/ftpd/security.c883
51 files changed, 0 insertions, 26284 deletions
diff --git a/appl/ftp/ChangeLog b/appl/ftp/ChangeLog
deleted file mode 100644
index 72df672d6987..000000000000
--- a/appl/ftp/ChangeLog
+++ /dev/null
@@ -1,1038 +0,0 @@
-2008-05-29 Love Hörnquist Åstrand <lha@kth.se>
-
- * ftp/ftp.c: use the correct length to munmap and use msync.
-
-2008-05-28 Love Hörnquist Åstrand <lha@kth.se>
-
- * ftp/ftp.c: Rewrite sliding window code so it doesn't have a
- integer overrun.
-
- * ftp/ftp.c: Try sliding mmap window over memory file (10MB
- window), works better with larger files (ie doesn't fail).
-
-2008-04-10 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftpd/logwtmp.c: Use asl for logging ftpd wtmp messages.
-
-2007-07-12 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftp/gssapi.c: Fix pointer vs strict alias rules.
-
-2007-06-20 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftp/security.c: if no mech have no session, its ok, just don't
- call it.
-
- * ftp/security.h: provide prototype for sec_userok().
-
- * move ksetpag after initgroups to make it work on Linux when its
- without syscall hooks to change sys_setgroups preserve the
- pag. From Alexsander Boström.
-
-2007-06-09 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftpd/Makefile.am: don't clean yacc/lex files in CLEANFILES,
- maintainers clean will do that for us.
-
-2006-10-07 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftpd/Makefile.am: Add man_MANS to EXTRA_DIST
-
- * ftp/Makefile.am: Add man_MANS to EXTRA_DIST
-
-2006-08-08 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftpd/ftpd.c: Add comment by seteuid call isn't not needed.
-
- * ftpd/ftpd.c: Check return values from seteuid, prompted by MIT
- advisory. Thanks to Tom Yu at MIT, and Michael Calmer and Marcus
- Meissner at SUSE. Either of CVE-2006-3083 or CVE-2006-3084.
-
-2006-06-27 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftpd/gss_userok.c (gss_userok): create a local krb5_context and
- use that instead of the libgssapi context (that might not exist).
-
-2006-05-05 Love Hörnquist Åstrand <lha@it.su.se>
-
- * Rename u_intXX_t to uintXX_t
-
-2006-03-23 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftp/ftp.1: Add undocument flags and spelling, from Ted Percival
- <Ted.Percival@quest.com>
-
-2006-02-27 Johan Danielsson <joda@pdc.kth.se>
-
- * ftpd/ftpd.8: fix grammar in --no-insecure-oob option (partly
- from Thomas Klausner)
-
-2006-01-24 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftp/ftp.c: Indent.
-
-2006-01-12 Johan Danielsson <joda@pdc.kth.se>
-
- * ftpd/ftpd.c (pass): remove unused variable in the !OTP case
-
-2005-10-22 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftpd/ls.c: Check return value from asprintf instead of string !=
- NULL since it undefined behavior on Linux. From Björn Sandell
-
- * ftpd/gss_userok.c: Check return value from asprintf instead of
- string != NULL since it undefined behavior on Linux. From Björn
- Sandell
-
- * ftpd/ftpd.c: Check return value from asprintf instead of string
- != NULL since it undefined behavior on Linux. From Björn Sandell
-
- * ftp/gssapi.c: Check return value from asprintf instead of string
- != NULL since it undefined behavior on Linux. From Björn Sandell
-
-2005-10-12 Johan Danielsson <joda@pdc.kth.se>
-
- * ftp/ftp.1: document -x
-
- * ftp/security.h: implement cprotect (from MIT)
-
- * ftp/security.c: add -x (encrypt) option; implement cprotect
- (from MIT); make sure we CCC if switching to clear-text command
- channel
-
- * ftp/cmdtab.c: implement cprotect (from MIT)
-
- * ftp/ruserpass.c: if doing command line encryption (-x), ignore
- prot commands in .netrc
-
- * ftp/ftp_var.h: add -x (encrypt) option
-
- * ftp/globals.c: add -x (encrypt) option
-
- * ftp/main.c: add -x (encrypt) option
-
-2005-07-19 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftpd/ftpcmd.y: Fix shadow warning.
-
- * ftp/security.c: Fix shadow warning.
- * ftp/security.c: Fix shadow warnings.
-
- * ftp/ruserpass.c: Fix shadow warnings.
-
- * ftp/ftp.c: Fix shadow warnings.
-
- * ftp/cmds.c: fix shadow warnings
-
- * Add Kerberos 5 klist, old patch from Tomas Nyström (remove krb4
- support). Support klist in client for kerberos 5 clase.
- Clean up delegation of gss tokens and do afslog.
-
-2005-07-13 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftp/gssapi.c (gss_adat): avoid leaking memory
- (gss_auth): always try next kname if there is one, independant of
- min_stat
-
- * ftp/gssapi.c: avoid const warning, use sin4 instead of sin to
- avoid shadow warning, free target_name
-
-2005-07-09 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftp/security.c: keep track of if CCC was passed
-
- * ftpd/extern.h: variable to keep track of if CCC was passed
-
- * ftpd/ftpcmd.y: sprinkel check_secure, check if CCC was passed in
- check_secure
-
-2005-06-02 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftpd/ftpd.c (filename_check): change signednes of p to avoid
- warning, move typecasts
-
-2005-05-29 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftpd/ftpd.c: avoid 'unused variable' warnings
-
-2005-05-10 David Love <fx@gnu.org>
-
- * ftpd/pathnames.h: #ifdef protect _PATH_ISSUE
-
-2005-04-25 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftp/domacro.c: handle string trunctions
-
-2005-04-24 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftp/security.c: use strlcat
-
- * ftp/domacro.c: use strlcpy
-
-2005-04-20 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftp/security.c: cast size_t to unsigned long
-
-2005-04-18 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftpd/ftpd.c (statcmd): cast argument to isdigit to unsigned char
-
- * ftp/cmds.c (mget): cast char to unsigned char to make sure its
- not negative when passing it to tolower
-
-2005-04-07 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftp/ftp.c: fix 3 'var' might be used uninitialized warnings
-
-2005-04-04 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftp/cmds.c: MacOS is also a unix that doesn't define
- __unix__/unix While here, rewrite this part of the function to not
- modify that string, but rather take a copy of it and them modify
- is, all this just to pacify gcc
-
-2005-01-09 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftp/domacro.c: cast argument to is* to unsigned char
-
- * ftp/ftp.c: cast argument to tolower to unsigned char
-
-2004-08-20 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftp/ftp.c: send ABOR protect with security layer if its there
-
- * ftpd/{ftpd_locl.h, extern.h, ftpcmd.y, ftpd.8, ftpd.c}:
- Remove all traces of setjmp/longjmp.
- Handle those command that is needed in oobhandler,
- those are ABOR, STAT, ENC, CONF, MIC.
- add options to turn off insecure OOB handling and document the option
-
- Changes inspired by openbsd and netbsd changes but quite diffrent is
- most places since the code no longer look and is structured the same
- way.
-
-2004-08-16 Johan Danielsson <joda@pdc.kth.se>
-
- * ftp/main.c: reverse help strings for --no-gss-bindings and
- --no-gss-delegate
-
-2004-06-20 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftpd/ftpcmd.y: make cbuf 64k to handle lager tickets From:
- MAAAAA MOOOR <huaraz@btinternet.com>
-
-2004-03-14 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftpd/ftpd.c (main): setpag if there is krb4 OR krb5 support
-
-2003-12-19 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftp/security.h: add ftp_do_gss_delegate
-
- * ftp/main.c (getargs): negative flag for delegating gss creds
-
- * ftp/gssapi.c (ftp_do_gss_delegate): delegate creds (default on)
-
-2003-09-03 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftp/ftp.c: s/des_read_pw_string/UI_UTIL_read_pw_string/
-
- * ftp/cmds.c: s/des_read_pw_string/UI_UTIL_read_pw_string/
-
-2003-07-19 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftp/security.h: add ftp_do_gss_bindings
-
- * ftp/ftp.1: fix mdoc bug
-
- * ftp/ftp.1: document --no-gss-bindings
-
- * ftp/gssapi.c: Optionally support gss bindings, client does it by
- default, server not. This is to make it work for clients behind
- NAT.
-
- * ftp/main.c (args): add gss-bindings
- (main): set ftp_do_gss_bindings to 1 to make client use them
-
- * ftpd/ftpd.c (args): add gss-bindings
-
- * ftpd/ftpd.8: document --gss-bindings
-
-2003-06-13 Johan Danielsson <joda@pdc.kth.se>
-
- * ftp/gssapi.c (gss_adat): fix name allocation bug
-
-2003-05-21 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftpd/gss_userok.c (gss_userok): release delegated cred handle
-
- * ftp/gssapi.c (gss_adat): remove poking inside the delegated
- handle, also fixes problem where to much memory was allocated
-
- * ftpd/gss_userok.c (gss_userok): remove poking inside the
- delegated handle
-
-2003-05-14 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftpd/ftpcmd.y: support afslog <cell> and afslog when compiled
- with krb5
-
-2003-05-07 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftp/cmdtab.c: include afslog in both the krb4 and krb5 case
-
- * ftp/kauth.c: include afslog in both the krb4 and krb5 case
-
- * ftp/Makefile.am: always include auth.c
-
-2003-05-07 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftpd/Makefile.am: always include auth.c
-
- * ftpd/kauth.c: do afslog in the krb5 case too
-
-2003-04-22 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftp/ftp.1: replace > with \*[Gt]
-
-2003-04-16 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftpd/ftpd.c: make sure argument to is* functions are unsigned
-
-2003-04-06 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftpd/ftpd.8: s/kerberos/Kerberos/
-
-2003-03-23 Assar Westerlund <assar@kth.se>
-
- * ftpd/pathnames.h (_PATH_FTPUSERS): conditionalize
-
-2003-03-18 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftpd/ftpd.c (krb5_verify): always do krb5_afslog, remove setpag
- (its done in main)
-
- * ftpd/gss_userok.c: drop setpag
-
- * ftpd/ftpd.c (main): set afs PAG
-
- * ftpd/gss_userok.c: always try krb5_afslog, and while here do a
- setpag too
-
- * ftpd/ftpd_locl.h: always include kafs
-
-2003-03-16 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftp/gssapi.c (gss_adat): now that gss_export_name exports a
- principal, bandaid with gss_display_name, and check that oid is
- GSS_KRB5_NT_PRINCIPAL_NAME, also free memory
-
-2003-02-25 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftp/gssapi.c (gss_auth): print out the name we authenticated too
-
-2003-02-25 Love Hörnquist Åstrand <lha@it.su.se>
-
- * ftpd/ls.c: use readlink with bufsize - 1, From NetBSD
-
- * ftp/ftp.1: s/utilizes/uses/ from NetBSD
-
- * ftpd/ftpd.8: s/utilize/use/ from NetBSD
-
-2003-02-10 Assar Westerlund <assar@kth.se>
-
- * ftpd/ftpd.c (accept_with_timeout): use socklen_t
-
-2002-10-29 Johan Danielsson <joda@pdc.kth.se>
-
- * ftp/main.c: reinstate -n flag (from Torbjörn Granlund)
-
-2002-10-16 Johan Danielsson <joda@pdc.kth.se>
-
- * ftp/ftp.c: fix parsing of epsv ports (from Love)
-
-2002-09-05 Johan Danielsson <joda@pdc.kth.se>
-
- * ftp/security.c (sec_vfprintf): free encoded data
-
- * ftp/gssapi.c (gss_decode): release buffer
-
- * ftp/ftp.c (active_mode): no need to allocate buffer for EPRT
-
-2002-08-28 Johan Danielsson <joda@pdc.kth.se>
-
- * ftp/ftp.c (command): clean up va_{start,end}ing (from NetBSD)
-
-2002-08-23 Assar Westerlund <assar@kth.se>
-
- * ftp/main.c: start using getarg
-
-2002-08-22 Johan Danielsson <joda@pdc.kth.se>
-
- * ftpd/ls.c: uxp/v lacks _S_IFMT, but has S_IFMT
-
-2002-08-20 Johan Danielsson <joda@pdc.kth.se>
-
- * ftp/gssapi.c: remove unused variable
-
-2002-04-24 Johan Danielsson <joda@pdc.kth.se>
-
- * ftp/ftp.c: fix buffer overrun when receiving long replies
-
-2002-04-02 Johan Danielsson <joda@pdc.kth.se>
-
- * ftpd/popen.c: make sure gl_pathc != 0 before referencing
- gl_pathv
-
-2002-03-15 Johan Danielsson <joda@pdc.kth.se>
-
- * ftp/gssapi.c (gss_adat): if accept_sec_context fails, syslog a
- reason and give a temporary error message
-
-2002-02-28 Johan Danielsson <joda@pdc.kth.se>
-
- * ftpd/ftpd.c: if builtin_ls failes, return error
-
- * ftpd/ls.c (builtin_ls): return status; also don't print fatal
- error messages to the output stream, instead use syslog
-
-2001-09-14 Johan Danielsson <joda@pdc.kth.se>
-
- * ftpd/ls.c: make sure we don't include . in recursive listings
-
-2001-09-13 Johan Danielsson <joda@pdc.kth.se>
-
- * ftpd/ftpd.c (dataconn): don't wait forever on accept
-
-2001-09-04 Assar Westerlund <assar@sics.se>
-
- * ftp/gssapi.c (gss_adat): leak less memory and check return value
- from asprintf
-
-2001-08-28 Jacques Vidrine <n@nectar.com>
-
- * ftpd/ftpd.c, ftpd/ftpd.8: On systems with IP_PORTRANGE, have
- ftpd use `high-numbered' ports by default. Add a -U option
- to get the old behavior.
-
-2001-08-28 Johan Danielsson <joda@pdc.kth.se>
-
- * ftp/gssapi.c: try using "host" if there's no "ftp" principal
-
-2001-08-26 Johan Danielsson <joda@pdc.kth.se>
-
- * ftpd/ls.c: implement -R
-
-2001-08-08 Assar Westerlund <assar@sics.se>
-
- * ftpd/ls.c: make -a and -A do the same as in ls(1)
-
-2001-08-05 Assar Westerlund <assar@sics.se>
-
- * ftpd/ftpcmd.y: add some (unsigned char) casts to is*
- * ftp/cmds.c: add some (unsigned char) casts to is*
- * ftpd/gss_userok.c (gss_userok): make argument to printf type
- correct
-
-2001-08-05 Assar Westerlund <assar@sics.se>
-
- * ftp/cmds.c (setpeer): __NetBSD__ is also a unix-like OS
-
-2001-06-19 Assar Westerlund <assar@sics.se>
-
- * ftpd/popen.c, ftpd/ftpd.c: try to handle GLOB_MAXPATH (FreeBSD)
-
-2001-04-19 Johan Danielsson <joda@pdc.kth.se>
-
- * ftpd/ftpd.c (do_store): call closefunc before claiming that
- everything went ok, if the close fails the file might not have
- been stored properly
-
-2001-03-26 Assar Westerlund <assar@sics.se>
-
- * ftpd/ftpd.c, ftpd/popen.c: always use GLOB_LIMIT
- * ftpd/popen.c (ftpd_popen): use GLOB_LIMIT if defined
- * ftpd/ftpd.c (send_file_list): use GLOB_LIMIT if defined
-
-2001-02-15 Assar Westerlund <assar@sics.se>
-
- * ftp/cmds.c (setpeer): handle both service names and port numbers
- for the second optional argument. also make parsing more robust
-
-2001-02-07 Assar Westerlund <assar@sics.se>
-
- * ftp/security.c (sec_end): only clean app_data if there is any
- (*): do realloc consistently
-
-2001-02-05 Assar Westerlund <assar@sics.se>
-
- * ftpd/popen.c (ftpd_popen): avoid overwriting the bounds of argv
- and gargv
-
-2001-01-30 Assar Westerlund <assar@sics.se>
-
- * ftpd/gss_userok.c: use gss_krb5_copy_ccache
-
-2001-01-29 Assar Westerlund <assar@sics.se>
-
- * ftpd/Makefile.am: move up LIB_otp so we do not end up picking
- one from /usr/athena
-
-2001-01-25 Johan Danielsson <joda@pdc.kth.se>
-
- * ftpd/ls.c: fix bug in previous; make it easier to build test
- version
-
-2001-01-19 Johan Danielsson <joda@pdc.kth.se>
-
- * ftpd/ls.c (lstat_file): handle case where file lives in `/'
-
-2001-01-18 Johan Danielsson <joda@pdc.kth.se>
-
- * ftpd/ftpd.c (pasv): close already open passive port
-
-2000-12-14 Johan Danielsson <joda@pdc.kth.se>
-
- * ftpd/ls.c: reverse time and size sort order (pointed out by
- tege)
-
-2000-12-11 Johan Danielsson <joda@pdc.kth.se>
-
- * ftpd/ftpd.c: make it possible to set list of good filename
- characters from command line
-
-2000-12-10 Johan Danielsson <joda@pdc.kth.se>
-
- * ftpd/ftpd.c: some spec-violating mirror software assumes that
- you can do things like `LIST -CF'; don't pass `--' to ls so this
- actually works
-
- * ftpd/ls.c: implement -1CFx flags
-
-2000-12-08 Assar Westerlund <assar@sics.se>
-
- * ftpd/gss_userok.c (gss_userok): handle getpwnam failing
- * ftp/gssapi.c (gss_auth): be more explicit in error message
-
-2000-11-29 Johan Danielsson <joda@pdc.kth.se>
-
- * ftpd/ftpd.8: close list
-
-2000-11-15 Assar Westerlund <assar@sics.se>
-
- * ftp/main.c: add `-l' for no line-editing
- * ftp/globals.c (readline): add
- * ftp/ftp_var.h (lineedit): add variable indicated if we should
- use readline
-
-2000-11-09 Johan Danielsson <joda@pdc.kth.se>
-
- * ftp/security.c (sec_read): fix bug in previous (from Jacques A.
- Vidrine <n@nectar.com>)
-
-2000-11-05 Johan Danielsson <joda@pdc.kth.se>
-
- * ftpd/ftpcmd.y: only allow pasv if logged in
-
-2000-10-23 Johan Danielsson <joda@pdc.kth.se>
-
- * ftpd/ftpd.c: change bad filename message slightly
-
- * common/buffer.c: HAVE_ST_BLKSIZE -> HAVE_STRUCT_STAT_ST_BLKSIZE
-
-2000-10-08 Assar Westerlund <assar@sics.se>
-
- * ftp/ftp.c (*): check that fds are not too large to select on
- * ftp/main.c (cmdscanner): print a newline upon EOF
-
-2000-09-19 Assar Westerlund <assar@sics.se>
-
- * ftp/security.h: add some attributes to prototypes of sec*
- * ftp/extern.h (command): add attributes
-
-2000-08-31 Johan Danielsson <joda@pdc.kth.se>
-
- * ftpd/ftpd.c: change redundant password message to something
- people can understand
-
-2000-07-27 Assar Westerlund <assar@sics.se>
-
- * ftpd/gss_userok.c (gss_userok): only do AFS iff KRB4
- * ftpd/ftpd.c (krb5_verify): only do AFS stuff if KRB4
-
-2000-07-07 Assar Westerlund <assar@sics.se>
-
- * ftpd/ftpd.c: do not call setproctitle with a variable as the
- format string
-
-2000-07-01 Assar Westerlund <assar@sics.se>
-
- * ftpd/ftpd_locl.h: krb5.h before kafs.h
- * ftpd/ftpd.c (krb5_verify): static-ize
- * ftpd/ftpd.c (krb5_verify): conditionalize on KRB5
-
-2000-06-21 Assar Westerlund <assar@sics.se>
-
- * ftpd: support for authenticating passwords with krb5, by Daniel
- Kouril <kouril@ics.muni.cz>
-
-2000-06-06 Johan Danielsson <joda@pdc.kth.se>
-
- * ftpd/ftpcmd.y: change unix test to be negative
-
-2000-05-18 Assar Westerlund <assar@sics.se>
-
- * ftpd/ftpd.c (args): should use `debug'. From Onno van der
- Linden <onno@simplex.nl>.
-
-2000-04-25 Assar Westerlund <assar@sics.se>
-
- * ftp/ftp.c (login): re-structure code so that we prompt for
- password for ftp/anonymous
-
-2000-04-11 Assar Westerlund <assar@sics.se>
-
- * ftp/ftp.c (login): initialize tmp before calling fgets
-
-2000-04-02 Assar Westerlund <assar@sics.se>
-
- * ftpd/ls.c: rename all st_mtime variables to avoid conflict with
- #define.
- * ftpd/ftpcmd.y: rename all st_mtime variables to avoid conflict
- with #define.
- * ftp/cmds.c: rename all st_mtime variables to avoid conflict with
- #define.
-
-2000-03-26 Assar Westerlund <assar@sics.se>
-
- * ftpd/ls.c, ftpd/ftpcmd.y, ftp/cmds.c: make sure to always call
- time, ctime, and gmtime with `time_t's. there were some types
- (like in lastlog) that we believed to always be time_t. this has
- proven wrong on Solaris 8 in 64-bit mode, where they are stored as
- 32-bit quantities but time_t has gone up to 64 bits
-
-2000-03-09 Johan Danielsson <joda@pdc.kth.se>
-
- * call list_file for broken usages of nlst too
-
- * ftpd/ftpd.c: call list_file for broken usages of nlst too
-
-2000-02-07 Assar Westerlund <assar@sics.se>
-
- * ftp/security.c (sec_read): more paranoia with return value from
- sec_get_data
-
-2000-01-08 Assar Westerlund <assar@sics.se>
-
- * ftp/ftp.c (hookup): handle ai_canonname being set in any of the
- addresses returnedby getaddrinfo. glibc apparently returns the
- reverse lookup of every address in ai_canonname.
- * ftp/ruserpass.c (guess_domain): dito
-
-1999-12-21 Assar Westerlund <assar@sics.se>
-
- * ftpd/ftpd.c: don't use sa_len as a parameter, it's defined on
- Irix
-
-1999-12-21 Johan Danielsson <joda@pdc.kth.se>
-
- * ftpd/ftpd.c (dataconn): make sure from points to actual data
-
-1999-12-16 Assar Westerlund <assar@sics.se>
-
- * ftp/ruserpass.c (guess_domain): handle ai_canonname not being
- set
- * ftp/ftp.c (hookup): handle ai_canonname not being set
-
-1999-12-06 Assar Westerlund <assar@sics.se>
-
- * ftp/krb4.c (krb4_auth): the nat-IP address might not be realm
- bounded.
-
-1999-12-05 Assar Westerlund <assar@sics.se>
-
- * ftpd/ftpd.c (dolog): update prototype
- * ftpd/ftpd.c (dolog): use getnameinfo_verified
- * ftpd/ftpd.c: replace inaddr2str by getnameinfo
-
-1999-12-04 Assar Westerlund <assar@sics.se>
-
- * ftp/ruserpass.c (guess_domain): re-write to use getaddrinfo
- * ftp/ftp.c (hookup): re-write to use getaddrinfo
-
-1999-11-30 Assar Westerlund <assar@sics.se>
-
- * ftpd/ftpd.c (getdatasock): make sure to keep the port-number of
- the outgoing connections. It has to be `ftp-data' or some people
- might get upset.
-
- * ftpd/ftpd.c (args): set correct variable when `-l' so that
- logging actually works
-
-1999-11-29 Assar Westerlund <assar@sics.se>
-
- * ftp/security.c (sec_login): check return value from realloc
- (sec_end): set app_data to NULL
-
-1999-11-25 Assar Westerlund <assar@sics.se>
-
- * ftp/krb4.c (krb4_auth): obtain the `local' address when doing
- NAT. also turn on passive mode. From <thn@stacken.kth.se>
-
-1999-11-20 Assar Westerlund <assar@sics.se>
-
- * ftpd/ls.c (make_fileinfo): cast to allow for non-const
- prototypes of readlink
-
-1999-11-12 Assar Westerlund <assar@sics.se>
-
- * ftpd/ftpd.c (args): use arg_counter for `l'
-
-1999-11-04 Assar Westerlund <assar@sics.se>
-
- * ftpd/ls.c (S_ISSOCK, S_ISLNK): fallback definitions for systems
- that don't have them (such as ultrix)
-
-1999-10-29 Assar Westerlund <assar@sics.se>
-
- * ftpd/ls.c (make_fileinfo): cast uid's and gid's to unsigned in
- printf, we don't know what types they might be.
- (lstat_file): conditionalize the kafs part on KRB4
-
- * ftpd/ftpd_locl.h: <sys/ioccom.h> is needed for kafs.h
-
-1999-10-28 Assar Westerlund <assar@sics.se>
-
- * ftpd/ls.c (lstat_file): don't set st_mode, it should already be
- correct
-
- * ftpd/ls.c: don't use warnx to print errors
-
- * ftpd/ls.c (builtin_ls): fix typo, 'd' shouldn't imply 'f'
-
- * ftpd/ls.c (lstat_file): new function for avoiding stating AFS
- mount points. From Love <lha@s3.kth.se>
- (list_files): use `lstat_file'
-
- * ftpd/ftpd.c: some const-poisoning
-
- * ftpd/ftpd.c (args): add `-B' as an alias for `--builtin-ls' to
- allow for stupid inetds that only support two arguments. From
- Love <lha@s3.kth.se>
-
-1999-10-26 Assar Westerlund <assar@sics.se>
-
- * ftpd/ftpcmd.y (help): it's unnecessary to interpret help strings
- as printf commands
-
- * ftpd/ftpd.c (show_issue): don't interpret contents of
- /etc/issue* as printf commands. From Brian A May
- <bmay@dgs.monash.edu.au>
-
-1999-10-21 Johan Danielsson <joda@pdc.kth.se>
-
- * ftpd/kauth.c (kauth): complain if protection level isn't
- `private'
-
- * ftp/krb4.c (krb4_decode): syslog failure reason
-
- * ftp/kauth.c (kauth): set private level earlier
-
- * ftp/security.c: get_command_prot; (sec_prot): partially match
- `command' and `data'
-
-1999-10-18 Johan Danielsson <joda@pdc.kth.se>
-
- * ftpd/ftpd.c: change `-l' flag to use arg_collect (this makes
- `-ll' work again)
-
- * ftpd/ftpd.c (list_file): pass filename to ls
-
-1999-10-04 Johan Danielsson <joda@pdc.kth.se>
-
- * ftpd/ftpcmd.y: FEAT
-
-1999-10-03 Assar Westerlund <assar@sics.se>
-
- * ftpd/ls.c: fall-back definitions for constans and casts for
- printfs
-
-1999-10-03 Johan Danielsson <joda@pdc.kth.se>
-
- * ftpd/ftpd.c (main): make this use getarg; add `list_file'
-
- * ftpd/ftpcmd.y (LIST): call list_file
-
- * ftpd/ls.c: add simple built-in ls
-
- * ftp/security.c: add `sec_vfprintf2' and `sec_fprintf2' that
- prints to the data stream
-
- * ftp/kauth.c (kauth): make sure we're using private protection
- level
-
- * ftp/security.c (set_command_prot): set command protection level
-
- * ftp/security.c: make it possible to set the command protection
- level with `prot'
-
-1999-09-30 Assar Westerlund <assar@sics.se>
-
- * ftpd/ftpd_locl.h: add prototype for fclose to make sunos happy
-
-1999-08-19 Johan Danielsson <joda@pdc.kth.se>
-
- * ftpd/ftpd.c (do_login): show issue-file
- (send_data): change handling of zero-byte files
-
-1999-08-18 Assar Westerlund <assar@sics.se>
-
- * ftp/cmds.c (getit): be more suspicious when parsing the result
- of MDTM. Do the comparison of timestamps correctly.
-
-1999-08-13 Assar Westerlund <assar@sics.se>
-
- * ftpd/ftpd.c (send_data): avoid calling mmap with `len == 0'.
- Some mmap:s rather dislike that (Solaris) and some munmap (Linux)
- get grumpy later.
-
- * ftp/ftp.c (copy_stream): avoid calling mmap with `len == 0'.
- Some mmap:s rather dislike that (Solaris) and some munmap (Linux)
- get grumpy later.
-
-1999-08-03 Assar Westerlund <assar@sics.se>
-
- * ftp/ftp.c (active_mode): hide failure of EPRT by setting verbose
-
- * ftp/gssapi.c (gss_auth): initialize application_data in bindings
-
-1999-08-02 Assar Westerlund <assar@sics.se>
-
- * ftpd/ftpcmd.y: save file names when doing commands that might
- get aborted (and longjmp:ed out of) to avoid overwriting them also
- remove extra closing brace
-
-1999-08-01 Johan Danielsson <joda@pdc.kth.se>
-
- * ftpd/ftpcmd.y: change `site find' to `site locate' (to match
- what it does, and other implementations) keep find as an alias
-
-1999-07-28 Assar Westerlund <assar@sics.se>
-
- * common/socket.c: moved to roken
-
- * common/socket.c: new file with generic socket functions
-
- * ftpd/ftpd.c: make it more AF-neutral and v6-capable
-
- * ftpd/ftpcmd.y: add EPRT and EPSV
-
- * ftpd/extern.h: update prototypes and variables
-
- * ftp/krb4.c: update to new types of addresses
-
- * ftp/gssapi.c: add support for both AF_INET and AF_INET6
- addresses
-
- * ftp/ftp.c: make it more AF-neutral and v6-capable
-
- * ftp/extern.h (hookup): change prototype
-
- * common/common.h: add prototypes for functions in socket.c
-
- * common/Makefile.am (libcommon_a_SOURCES): add socket.c
-
- * ftp/gssapi.c (gss_auth): check return value from
- `gss_import_name' and print error messages if it fails
-
-1999-06-15 Assar Westerlund <assar@sics.se>
-
- * ftp/krb4.c (krb4_auth): type correctness
-
-1999-06-02 Johan Danielsson <joda@pdc.kth.se>
-
- * ftp/ftp.c (sendrequest): lmode != rmode
-
-1999-05-21 Assar Westerlund <assar@sics.se>
-
- * ftp/extern.h (sendrequest): update prototype
-
- * ftp/cmds.c: update calls to sendrequest and recvrequest to send
- "b" when appropriate
-
- * ftp/ftp.c (sendrequest): add argument for mode to open file in.
-
-1999-05-08 Assar Westerlund <assar@sics.se>
-
- * ftpd/ftpcmd.y: rename getline -> ftpd_getline
-
- * ftp/main.c (makeargv): fill in unused slots with NULL
-
-Thu Apr 8 15:06:40 1999 Johan Danielsson <joda@hella.pdc.kth.se>
-
- * ftpd/ftpd.c: remove definition of KRB_VERIFY_USER (moved to
- config.h)
-
-Wed Apr 7 16:15:21 1999 Johan Danielsson <joda@hella.pdc.kth.se>
-
- * ftp/gssapi.c (gss_auth): call gss_display_status to get a sane
- error message; return AUTH_{CONTINUE,ERROR}, where appropriate
-
- * ftp/krb4.c: return AUTH_{CONTINUE,ERROR}, where appropriate
-
- * ftp/security.c (sec_login): if mechanism returns AUTH_CONTINUE,
- just continue with the next mechanism, this fixes the case of
- having GSSAPI fail because of non-existant of expired tickets
-
- * ftp/security.h: add AUTH_{OK,CONTINUE,ERROR}
-
-Thu Apr 1 16:59:04 1999 Johan Danielsson <joda@hella.pdc.kth.se>
-
- * ftpd/Makefile.am: don't run check-local
-
- * ftp/Makefile.am: don't run check-local
-
-Mon Mar 22 22:15:18 1999 Assar Westerlund <assar@sics.se>
-
- * ftpd/ftpd.c (pass): fall-back for KRB_VERIFY_SECURE
-
- * ftpd/ftpd.c (pass): 1 -> KRB_VERIFY_SECURE
-
-Thu Mar 18 12:07:09 1999 Johan Danielsson <joda@hella.pdc.kth.se>
-
- * ftpd/Makefile.am: clean ftpcmd.c
-
- * ftpd/ftpd_locl.h: remove krb5.h (breaks in ftpcmd.y)
-
- * ftpd/ftpd.c: move include of krb5.h here
-
- * ftpd/Makefile.am: include Makefile.am.common
-
- * Makefile.am: include Makefile.am.common
-
- * ftp/Makefile.am: include Makefile.am.common
-
- * common/Makefile.am: include Makefile.am.common
-
-Tue Mar 16 22:28:37 1999 Assar Westerlund <assar@sics.se>
-
- * ftpd/ftpd_locl.h: add krb5.h to get heimdal_version
-
- * ftpd/ftpd.c: krb_verify_user_multiple -> krb_verify_user
-
-Thu Mar 11 14:54:59 1999 Johan Danielsson <joda@hella.pdc.kth.se>
-
- * ftp/Makefile.in: WFLAGS
-
- * ftp/ruserpass.c: add some if-braces
-
-Wed Mar 10 20:02:55 1999 Johan Danielsson <joda@hella.pdc.kth.se>
-
- * ftpd/ftpd_locl.h: remove ifdef HAVE_FNMATCH
-
-Mon Mar 8 21:29:24 1999 Johan Danielsson <joda@hella.pdc.kth.se>
-
- * ftpd/ftpd.c: re-add version in greeting message
-
-Mon Mar 1 10:49:38 1999 Johan Danielsson <joda@hella.pdc.kth.se>
-
- * ftpd/logwtmp.c: HAVE_UT_* -> HAVE_STRUCT_UTMP*_UT_*
-
-Mon Feb 22 19:20:51 1999 Johan Danielsson <joda@hella.pdc.kth.se>
-
- * common/Makefile.in: remove glob
-
-Sat Feb 13 17:19:35 1999 Assar Westerlund <assar@sics.se>
-
- * ftpd/ftpd.c (match): remove #ifdef HAVE_FNMATCH. We have a
- fnmatch implementation in roken and therefore always have it.
-
- * ftp/ftp.c (copy_stream): initialize `werr'
-
-Wed Jan 13 23:52:57 1999 Assar Westerlund <assar@sics.se>
-
- * ftpd/ftpcmd.y: moved all check_login and check_login_no_guest to
- the end of the rules to ensure we don't generate several
- (independent) error messages. once again, having a yacc-grammar
- for FTP with embedded actions doesn't strike me as the most
- optimal way of doing it.
-
-Tue Dec 1 14:44:29 1998 Johan Danielsson <joda@hella.pdc.kth.se>
-
- * ftpd/Makefile.am: link with extra libs for aix
-
-Sun Nov 22 10:28:20 1998 Assar Westerlund <assar@sics.se>
-
- * ftpd/ftpd.c (retrying): support on-the-fly decompression
-
- * ftpd/Makefile.in (WFLAGS): set
-
- * ftp/ruserpass.c (guess_domain): new function
- (ruserpass): use it
-
- * common/Makefile.in (WFLAGS): set
-
- * Makefile.in (WFLAGS): set
-
-Sat Nov 21 23:13:03 1998 Assar Westerlund <assar@sics.se>
-
- * ftp/security.c: some more type correctness.
-
- * ftp/gssapi.c (gss_adat): more braces to shut up warnings
-
-Wed Nov 18 21:47:55 1998 Assar Westerlund <assar@sics.se>
-
- * ftp/main.c (main): new option `-p' for enable passive mode.
-
-Mon Nov 2 01:57:49 1998 Assar Westerlund <assar@sics.se>
-
- * ftp/ftp.c (getreply): remove extra `break'
-
- * ftp/gssapi.c (gss_auth): fixo typo(copyo?)
-
- * ftp/security.c (sec_login): fix loop and return value
-
-Tue Sep 1 16:56:42 1998 Johan Danielsson <joda@emma.pdc.kth.se>
-
- * ftp/cmds.c (quote1): fix % quoting bug
-
-Fri Aug 14 17:10:06 1998 Johan Danielsson <joda@emma.pdc.kth.se>
-
- * ftp/krb4.c: krb_put_int -> KRB_PUT_INT
-
-Tue Jun 30 18:07:15 1998 Assar Westerlund <assar@sics.se>
-
- * ftp/security.c (auth): free `app_data'
- (sec_end): only destroy if it was initialized
-
-Tue Jun 9 21:01:59 1998 Johan Danielsson <joda@emma.pdc.kth.se>
-
- * ftp/krb4.c: pass client address to krb_rd_req
-
-Sat May 16 00:02:07 1998 Assar Westerlund <assar@sics.se>
-
- * ftpd/Makefile.am: link with DBLIB
-
-Tue May 12 14:15:32 1998 Johan Danielsson <joda@emma.pdc.kth.se>
-
- * ftp/gssapi.c: Save client name for userok().
-
- * ftpd/gss_userok.c: Userok for gssapi.
-
-Fri May 1 07:15:01 1998 Assar Westerlund <assar@sics.se>
-
- * ftp/ftp.c: unifdef -DHAVE_H_ERRNO
-
-Fri Mar 27 00:46:07 1998 Johan Danielsson <joda@emma.pdc.kth.se>
-
- * Make compile w/o krb4.
-
-Thu Mar 26 03:49:12 1998 Johan Danielsson <joda@emma.pdc.kth.se>
-
- * ftp/*, ftpd/*: Changes for new framework.
-
- * ftp/gssapi.c: GSS-API backend for the new security framework.
-
- * ftp/krb4.c: Updated for new framework.
-
- * ftp/security.{c,h}: New unified security framework.
diff --git a/appl/ftp/Makefile.am b/appl/ftp/Makefile.am
deleted file mode 100644
index efea85d0e59e..000000000000
--- a/appl/ftp/Makefile.am
+++ /dev/null
@@ -1,7 +0,0 @@
-# $Id$
-
-include $(top_srcdir)/Makefile.am.common
-
-SUBDIRS = common ftp ftpd
-
-EXTRA_DIST = NTMakefile \ No newline at end of file
diff --git a/appl/ftp/Makefile.in b/appl/ftp/Makefile.in
deleted file mode 100644
index 9930a95bbd09..000000000000
--- a/appl/ftp/Makefile.in
+++ /dev/null
@@ -1,916 +0,0 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-@SET_MAKE@
-
-# $Id$
-
-# $Id$
-
-# $Id$
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
- $(top_srcdir)/Makefile.am.common \
- $(top_srcdir)/cf/Makefile.am.common ChangeLog
-subdir = appl/ftp
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/cf/aix.m4 \
- $(top_srcdir)/cf/auth-modules.m4 \
- $(top_srcdir)/cf/broken-getaddrinfo.m4 \
- $(top_srcdir)/cf/broken-glob.m4 \
- $(top_srcdir)/cf/broken-realloc.m4 \
- $(top_srcdir)/cf/broken-snprintf.m4 $(top_srcdir)/cf/broken.m4 \
- $(top_srcdir)/cf/broken2.m4 $(top_srcdir)/cf/c-attribute.m4 \
- $(top_srcdir)/cf/capabilities.m4 \
- $(top_srcdir)/cf/check-compile-et.m4 \
- $(top_srcdir)/cf/check-getpwnam_r-posix.m4 \
- $(top_srcdir)/cf/check-man.m4 \
- $(top_srcdir)/cf/check-netinet-ip-and-tcp.m4 \
- $(top_srcdir)/cf/check-type-extra.m4 \
- $(top_srcdir)/cf/check-var.m4 $(top_srcdir)/cf/check-x.m4 \
- $(top_srcdir)/cf/check-xau.m4 $(top_srcdir)/cf/crypto.m4 \
- $(top_srcdir)/cf/db.m4 $(top_srcdir)/cf/destdirs.m4 \
- $(top_srcdir)/cf/dispatch.m4 $(top_srcdir)/cf/dlopen.m4 \
- $(top_srcdir)/cf/find-func-no-libs.m4 \
- $(top_srcdir)/cf/find-func-no-libs2.m4 \
- $(top_srcdir)/cf/find-func.m4 \
- $(top_srcdir)/cf/find-if-not-broken.m4 \
- $(top_srcdir)/cf/framework-security.m4 \
- $(top_srcdir)/cf/have-struct-field.m4 \
- $(top_srcdir)/cf/have-type.m4 $(top_srcdir)/cf/irix.m4 \
- $(top_srcdir)/cf/krb-bigendian.m4 \
- $(top_srcdir)/cf/krb-func-getlogin.m4 \
- $(top_srcdir)/cf/krb-ipv6.m4 $(top_srcdir)/cf/krb-prog-ln-s.m4 \
- $(top_srcdir)/cf/krb-readline.m4 \
- $(top_srcdir)/cf/krb-struct-spwd.m4 \
- $(top_srcdir)/cf/krb-struct-winsize.m4 \
- $(top_srcdir)/cf/largefile.m4 $(top_srcdir)/cf/libtool.m4 \
- $(top_srcdir)/cf/ltoptions.m4 $(top_srcdir)/cf/ltsugar.m4 \
- $(top_srcdir)/cf/ltversion.m4 $(top_srcdir)/cf/lt~obsolete.m4 \
- $(top_srcdir)/cf/mips-abi.m4 $(top_srcdir)/cf/misc.m4 \
- $(top_srcdir)/cf/need-proto.m4 $(top_srcdir)/cf/osfc2.m4 \
- $(top_srcdir)/cf/otp.m4 $(top_srcdir)/cf/pkg.m4 \
- $(top_srcdir)/cf/proto-compat.m4 $(top_srcdir)/cf/pthreads.m4 \
- $(top_srcdir)/cf/resolv.m4 $(top_srcdir)/cf/retsigtype.m4 \
- $(top_srcdir)/cf/roken-frag.m4 \
- $(top_srcdir)/cf/socket-wrapper.m4 $(top_srcdir)/cf/sunos.m4 \
- $(top_srcdir)/cf/telnet.m4 $(top_srcdir)/cf/test-package.m4 \
- $(top_srcdir)/cf/version-script.m4 $(top_srcdir)/cf/wflags.m4 \
- $(top_srcdir)/cf/win32.m4 $(top_srcdir)/cf/with-all.m4 \
- $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
- $(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/include/config.h
-CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
-SOURCES =
-DIST_SOURCES =
-RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
- html-recursive info-recursive install-data-recursive \
- install-dvi-recursive install-exec-recursive \
- install-html-recursive install-info-recursive \
- install-pdf-recursive install-ps-recursive install-recursive \
- installcheck-recursive installdirs-recursive pdf-recursive \
- ps-recursive uninstall-recursive
-RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
- distclean-recursive maintainer-clean-recursive
-AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
- $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
- distdir
-ETAGS = etags
-CTAGS = ctags
-DIST_SUBDIRS = $(SUBDIRS)
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-am__relativize = \
- dir0=`pwd`; \
- sed_first='s,^\([^/]*\)/.*$$,\1,'; \
- sed_rest='s,^[^/]*/*,,'; \
- sed_last='s,^.*/\([^/]*\)$$,\1,'; \
- sed_butlast='s,/*[^/]*$$,,'; \
- while test -n "$$dir1"; do \
- first=`echo "$$dir1" | sed -e "$$sed_first"`; \
- if test "$$first" != "."; then \
- if test "$$first" = ".."; then \
- dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
- dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
- else \
- first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
- if test "$$first2" = "$$first"; then \
- dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
- else \
- dir2="../$$dir2"; \
- fi; \
- dir0="$$dir0"/"$$first"; \
- fi; \
- fi; \
- dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
- done; \
- reldir="$$dir2"
-ACLOCAL = @ACLOCAL@
-AIX_EXTRA_KAFS = @AIX_EXTRA_KAFS@
-AMTAR = @AMTAR@
-AR = @AR@
-ASN1_COMPILE = @ASN1_COMPILE@
-ASN1_COMPILE_DEP = @ASN1_COMPILE_DEP@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CANONICAL_HOST = @CANONICAL_HOST@
-CAPNG_CFLAGS = @CAPNG_CFLAGS@
-CAPNG_LIBS = @CAPNG_LIBS@
-CATMAN = @CATMAN@
-CATMANEXT = @CATMANEXT@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-COMPILE_ET = @COMPILE_ET@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DBHEADER = @DBHEADER@
-DBLIB = @DBLIB@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DIR_com_err = @DIR_com_err@
-DIR_hcrypto = @DIR_hcrypto@
-DIR_hdbdir = @DIR_hdbdir@
-DIR_roken = @DIR_roken@
-DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-FGREP = @FGREP@
-GREP = @GREP@
-GROFF = @GROFF@
-INCLUDES_roken = @INCLUDES_roken@
-INCLUDE_hcrypto = @INCLUDE_hcrypto@
-INCLUDE_hesiod = @INCLUDE_hesiod@
-INCLUDE_krb4 = @INCLUDE_krb4@
-INCLUDE_libedit = @INCLUDE_libedit@
-INCLUDE_libintl = @INCLUDE_libintl@
-INCLUDE_openldap = @INCLUDE_openldap@
-INCLUDE_readline = @INCLUDE_readline@
-INCLUDE_sqlite3 = @INCLUDE_sqlite3@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LDFLAGS_VERSION_SCRIPT = @LDFLAGS_VERSION_SCRIPT@
-LEX = @LEX@
-LEXLIB = @LEXLIB@
-LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
-LIBADD_roken = @LIBADD_roken@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIB_AUTH_SUBDIRS = @LIB_AUTH_SUBDIRS@
-LIB_NDBM = @LIB_NDBM@
-LIB_XauFileName = @LIB_XauFileName@
-LIB_XauReadAuth = @LIB_XauReadAuth@
-LIB_XauWriteAuth = @LIB_XauWriteAuth@
-LIB_bswap16 = @LIB_bswap16@
-LIB_bswap32 = @LIB_bswap32@
-LIB_com_err = @LIB_com_err@
-LIB_com_err_a = @LIB_com_err_a@
-LIB_com_err_so = @LIB_com_err_so@
-LIB_crypt = @LIB_crypt@
-LIB_db_create = @LIB_db_create@
-LIB_dbm_firstkey = @LIB_dbm_firstkey@
-LIB_dbopen = @LIB_dbopen@
-LIB_dispatch_async_f = @LIB_dispatch_async_f@
-LIB_dlopen = @LIB_dlopen@
-LIB_dn_expand = @LIB_dn_expand@
-LIB_dns_search = @LIB_dns_search@
-LIB_door_create = @LIB_door_create@
-LIB_freeaddrinfo = @LIB_freeaddrinfo@
-LIB_gai_strerror = @LIB_gai_strerror@
-LIB_getaddrinfo = @LIB_getaddrinfo@
-LIB_gethostbyname = @LIB_gethostbyname@
-LIB_gethostbyname2 = @LIB_gethostbyname2@
-LIB_getnameinfo = @LIB_getnameinfo@
-LIB_getpwnam_r = @LIB_getpwnam_r@
-LIB_getsockopt = @LIB_getsockopt@
-LIB_hcrypto = @LIB_hcrypto@
-LIB_hcrypto_a = @LIB_hcrypto_a@
-LIB_hcrypto_appl = @LIB_hcrypto_appl@
-LIB_hcrypto_so = @LIB_hcrypto_so@
-LIB_hesiod = @LIB_hesiod@
-LIB_hstrerror = @LIB_hstrerror@
-LIB_kdb = @LIB_kdb@
-LIB_krb4 = @LIB_krb4@
-LIB_libedit = @LIB_libedit@
-LIB_libintl = @LIB_libintl@
-LIB_loadquery = @LIB_loadquery@
-LIB_logout = @LIB_logout@
-LIB_logwtmp = @LIB_logwtmp@
-LIB_openldap = @LIB_openldap@
-LIB_openpty = @LIB_openpty@
-LIB_otp = @LIB_otp@
-LIB_pidfile = @LIB_pidfile@
-LIB_readline = @LIB_readline@
-LIB_res_ndestroy = @LIB_res_ndestroy@
-LIB_res_nsearch = @LIB_res_nsearch@
-LIB_res_search = @LIB_res_search@
-LIB_roken = @LIB_roken@
-LIB_security = @LIB_security@
-LIB_setsockopt = @LIB_setsockopt@
-LIB_socket = @LIB_socket@
-LIB_sqlite3 = @LIB_sqlite3@
-LIB_syslog = @LIB_syslog@
-LIB_tgetent = @LIB_tgetent@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
-NO_AFS = @NO_AFS@
-NROFF = @NROFF@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PKG_CONFIG = @PKG_CONFIG@
-PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
-PTHREAD_LDADD = @PTHREAD_LDADD@
-PTHREAD_LIBADD = @PTHREAD_LIBADD@
-RANLIB = @RANLIB@
-SED = @SED@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-SLC = @SLC@
-SLC_DEP = @SLC_DEP@
-STRIP = @STRIP@
-VERSION = @VERSION@
-VERSIONING = @VERSIONING@
-WFLAGS = @WFLAGS@
-WFLAGS_NOIMPLICITINT = @WFLAGS_NOIMPLICITINT@
-WFLAGS_NOUNUSED = @WFLAGS_NOUNUSED@
-XMKMF = @XMKMF@
-X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
-X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
-YACC = @YACC@
-YFLAGS = @YFLAGS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dpagaix_cflags = @dpagaix_cflags@
-dpagaix_ldadd = @dpagaix_ldadd@
-dpagaix_ldflags = @dpagaix_ldflags@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-subdirs = @subdirs@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-SUFFIXES = .et .h .x .z .hx .1 .3 .5 .8 .cat1 .cat3 .cat5 .cat8
-DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_srcdir)/include
-AM_CPPFLAGS = $(INCLUDES_roken)
-@do_roken_rename_TRUE@ROKEN_RENAME = -DROKEN_RENAME
-AM_CFLAGS = $(WFLAGS)
-CP = cp
-buildinclude = $(top_builddir)/include
-LIB_el_init = @LIB_el_init@
-LIB_getattr = @LIB_getattr@
-LIB_getpwent_r = @LIB_getpwent_r@
-LIB_odm_initialize = @LIB_odm_initialize@
-LIB_setpcred = @LIB_setpcred@
-HESIODLIB = @HESIODLIB@
-HESIODINCLUDE = @HESIODINCLUDE@
-libexec_heimdaldir = $(libexecdir)/heimdal
-NROFF_MAN = groff -mandoc -Tascii
-LIB_kafs = $(top_builddir)/lib/kafs/libkafs.la $(AIX_EXTRA_KAFS)
-@KRB5_TRUE@LIB_krb5 = $(top_builddir)/lib/krb5/libkrb5.la \
-@KRB5_TRUE@ $(top_builddir)/lib/asn1/libasn1.la
-
-@KRB5_TRUE@LIB_gssapi = $(top_builddir)/lib/gssapi/libgssapi.la
-LIB_heimbase = $(top_builddir)/base/libheimbase.la
-@DCE_TRUE@LIB_kdfs = $(top_builddir)/lib/kdfs/libkdfs.la
-SUBDIRS = common ftp ftpd
-EXTRA_DIST = NTMakefile
-all: all-recursive
-
-.SUFFIXES:
-.SUFFIXES: .et .h .x .z .hx .1 .3 .5 .8 .cat1 .cat3 .cat5 .cat8 .c
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.am.common $(top_srcdir)/cf/Makefile.am.common $(am__configure_deps)
- @for dep in $?; do \
- case '$(am__configure_deps)' in \
- *$$dep*) \
- ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
- && { if test -f $@; then exit 0; else break; fi; }; \
- exit 1;; \
- esac; \
- done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign appl/ftp/Makefile'; \
- $(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --foreign appl/ftp/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- @case '$?' in \
- *config.status*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
- *) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
- esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
-
-mostlyclean-libtool:
- -rm -f *.lo
-
-clean-libtool:
- -rm -rf .libs _libs
-
-# This directory's subdirectories are mostly independent; you can cd
-# into them and run `make' without going through this Makefile.
-# To change the values of `make' variables: instead of editing Makefiles,
-# (1) if the variable is set in `config.status', edit `config.status'
-# (which will cause the Makefiles to be regenerated when you run `make');
-# (2) otherwise, pass the desired values on the `make' command line.
-$(RECURSIVE_TARGETS):
- @fail= failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
- dot_seen=no; \
- target=`echo $@ | sed s/-recursive//`; \
- list='$(SUBDIRS)'; for subdir in $$list; do \
- echo "Making $$target in $$subdir"; \
- if test "$$subdir" = "."; then \
- dot_seen=yes; \
- local_target="$$target-am"; \
- else \
- local_target="$$target"; \
- fi; \
- ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
- done; \
- if test "$$dot_seen" = "no"; then \
- $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
- fi; test -z "$$fail"
-
-$(RECURSIVE_CLEAN_TARGETS):
- @fail= failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
- dot_seen=no; \
- case "$@" in \
- distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
- *) list='$(SUBDIRS)' ;; \
- esac; \
- rev=''; for subdir in $$list; do \
- if test "$$subdir" = "."; then :; else \
- rev="$$subdir $$rev"; \
- fi; \
- done; \
- rev="$$rev ."; \
- target=`echo $@ | sed s/-recursive//`; \
- for subdir in $$rev; do \
- echo "Making $$target in $$subdir"; \
- if test "$$subdir" = "."; then \
- local_target="$$target-am"; \
- else \
- local_target="$$target"; \
- fi; \
- ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
- done && test -z "$$fail"
-tags-recursive:
- list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
- done
-ctags-recursive:
- list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
- done
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- mkid -fID $$unique
-tags: TAGS
-
-TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- set x; \
- here=`pwd`; \
- if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
- include_option=--etags-include; \
- empty_fix=.; \
- else \
- include_option=--include; \
- empty_fix=; \
- fi; \
- list='$(SUBDIRS)'; for subdir in $$list; do \
- if test "$$subdir" = .; then :; else \
- test ! -f $$subdir/TAGS || \
- set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
- fi; \
- done; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- shift; \
- if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- if test $$# -gt 0; then \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- "$$@" $$unique; \
- else \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$unique; \
- fi; \
- fi
-ctags: CTAGS
-CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$unique" \
- || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$unique
-
-GTAGS:
- here=`$(am__cd) $(top_builddir) && pwd` \
- && $(am__cd) $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) "$$here"
-
-distclean-tags:
- -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
- if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
- if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d "$(distdir)/$$file"; then \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
- if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
- cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
- else \
- test -f "$(distdir)/$$file" \
- || cp -p $$d/$$file "$(distdir)/$$file" \
- || exit 1; \
- fi; \
- done
- @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
- if test "$$subdir" = .; then :; else \
- test -d "$(distdir)/$$subdir" \
- || $(MKDIR_P) "$(distdir)/$$subdir" \
- || exit 1; \
- fi; \
- done
- @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
- if test "$$subdir" = .; then :; else \
- dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
- $(am__relativize); \
- new_distdir=$$reldir; \
- dir1=$$subdir; dir2="$(top_distdir)"; \
- $(am__relativize); \
- new_top_distdir=$$reldir; \
- echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
- echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
- ($(am__cd) $$subdir && \
- $(MAKE) $(AM_MAKEFLAGS) \
- top_distdir="$$new_top_distdir" \
- distdir="$$new_distdir" \
- am__remove_distdir=: \
- am__skip_length_check=: \
- am__skip_mode_fix=: \
- distdir) \
- || exit 1; \
- fi; \
- done
- $(MAKE) $(AM_MAKEFLAGS) \
- top_distdir="$(top_distdir)" distdir="$(distdir)" \
- dist-hook
-check-am: all-am
- $(MAKE) $(AM_MAKEFLAGS) check-local
-check: check-recursive
-all-am: Makefile all-local
-installdirs: installdirs-recursive
-installdirs-am:
-install: install-recursive
-install-exec: install-exec-recursive
-install-data: install-data-recursive
-uninstall: uninstall-recursive
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-recursive
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
- -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-
-maintainer-clean-generic:
- @echo "This command is intended for maintainers to use"
- @echo "it deletes files that may require special tools to rebuild."
-clean: clean-recursive
-
-clean-am: clean-generic clean-libtool mostlyclean-am
-
-distclean: distclean-recursive
- -rm -f Makefile
-distclean-am: clean-am distclean-generic distclean-tags
-
-dvi: dvi-recursive
-
-dvi-am:
-
-html: html-recursive
-
-html-am:
-
-info: info-recursive
-
-info-am:
-
-install-data-am:
- @$(NORMAL_INSTALL)
- $(MAKE) $(AM_MAKEFLAGS) install-data-hook
-install-dvi: install-dvi-recursive
-
-install-dvi-am:
-
-install-exec-am:
- @$(NORMAL_INSTALL)
- $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
-install-html: install-html-recursive
-
-install-html-am:
-
-install-info: install-info-recursive
-
-install-info-am:
-
-install-man:
-
-install-pdf: install-pdf-recursive
-
-install-pdf-am:
-
-install-ps: install-ps-recursive
-
-install-ps-am:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-recursive
- -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-recursive
-
-mostlyclean-am: mostlyclean-generic mostlyclean-libtool
-
-pdf: pdf-recursive
-
-pdf-am:
-
-ps: ps-recursive
-
-ps-am:
-
-uninstall-am:
- @$(NORMAL_INSTALL)
- $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) check-am \
- ctags-recursive install-am install-data-am install-exec-am \
- install-strip tags-recursive uninstall-am
-
-.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
- all all-am all-local check check-am check-local clean \
- clean-generic clean-libtool ctags ctags-recursive dist-hook \
- distclean distclean-generic distclean-libtool distclean-tags \
- distdir dvi dvi-am html html-am info info-am install \
- install-am install-data install-data-am install-data-hook \
- install-dvi install-dvi-am install-exec install-exec-am \
- install-exec-hook install-html install-html-am install-info \
- install-info-am install-man install-pdf install-pdf-am \
- install-ps install-ps-am install-strip installcheck \
- installcheck-am installdirs installdirs-am maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-generic \
- mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
- uninstall uninstall-am uninstall-hook
-
-
-install-suid-programs:
- @foo='$(bin_SUIDS)'; \
- for file in $$foo; do \
- x=$(DESTDIR)$(bindir)/$$file; \
- if chown 0:0 $$x && chmod u+s $$x; then :; else \
- echo "*"; \
- echo "* Failed to install $$x setuid root"; \
- echo "*"; \
- fi; done
-
-install-exec-hook: install-suid-programs
-
-install-build-headers:: $(include_HEADERS) $(dist_include_HEADERS) $(nodist_include_HEADERS) $(build_HEADERZ) $(nobase_include_HEADERS)
- @foo='$(include_HEADERS) $(dist_include_HEADERS) $(nodist_include_HEADERS) $(build_HEADERZ)'; \
- for f in $$foo; do \
- f=`basename $$f`; \
- if test -f "$(srcdir)/$$f"; then file="$(srcdir)/$$f"; \
- else file="$$f"; fi; \
- if cmp -s $$file $(buildinclude)/$$f 2> /dev/null ; then \
- : ; else \
- echo " $(CP) $$file $(buildinclude)/$$f"; \
- $(CP) $$file $(buildinclude)/$$f; \
- fi ; \
- done ; \
- foo='$(nobase_include_HEADERS)'; \
- for f in $$foo; do \
- if test -f "$(srcdir)/$$f"; then file="$(srcdir)/$$f"; \
- else file="$$f"; fi; \
- $(mkdir_p) $(buildinclude)/`dirname $$f` ; \
- if cmp -s $$file $(buildinclude)/$$f 2> /dev/null ; then \
- : ; else \
- echo " $(CP) $$file $(buildinclude)/$$f"; \
- $(CP) $$file $(buildinclude)/$$f; \
- fi ; \
- done
-
-all-local: install-build-headers
-
-check-local::
- @if test '$(CHECK_LOCAL)' = "no-check-local"; then \
- foo=''; elif test '$(CHECK_LOCAL)'; then \
- foo='$(CHECK_LOCAL)'; else \
- foo='$(PROGRAMS)'; fi; \
- if test "$$foo"; then \
- failed=0; all=0; \
- for i in $$foo; do \
- all=`expr $$all + 1`; \
- if (./$$i --version && ./$$i --help) > /dev/null 2>&1; then \
- echo "PASS: $$i"; \
- else \
- echo "FAIL: $$i"; \
- failed=`expr $$failed + 1`; \
- fi; \
- done; \
- if test "$$failed" -eq 0; then \
- banner="All $$all tests passed"; \
- else \
- banner="$$failed of $$all tests failed"; \
- fi; \
- dashes=`echo "$$banner" | sed s/./=/g`; \
- echo "$$dashes"; \
- echo "$$banner"; \
- echo "$$dashes"; \
- test "$$failed" -eq 0 || exit 1; \
- fi
-
-.x.c:
- @cmp -s $< $@ 2> /dev/null || cp $< $@
-
-.hx.h:
- @cmp -s $< $@ 2> /dev/null || cp $< $@
-#NROFF_MAN = nroff -man
-.1.cat1:
- $(NROFF_MAN) $< > $@
-.3.cat3:
- $(NROFF_MAN) $< > $@
-.5.cat5:
- $(NROFF_MAN) $< > $@
-.8.cat8:
- $(NROFF_MAN) $< > $@
-
-dist-cat1-mans:
- @foo='$(man1_MANS)'; \
- bar='$(man_MANS)'; \
- for i in $$bar; do \
- case $$i in \
- *.1) foo="$$foo $$i";; \
- esac; done ;\
- for i in $$foo; do \
- x=`echo $$i | sed 's/\.[^.]*$$/.cat1/'`; \
- echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \
- $(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \
- done
-
-dist-cat3-mans:
- @foo='$(man3_MANS)'; \
- bar='$(man_MANS)'; \
- for i in $$bar; do \
- case $$i in \
- *.3) foo="$$foo $$i";; \
- esac; done ;\
- for i in $$foo; do \
- x=`echo $$i | sed 's/\.[^.]*$$/.cat3/'`; \
- echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \
- $(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \
- done
-
-dist-cat5-mans:
- @foo='$(man5_MANS)'; \
- bar='$(man_MANS)'; \
- for i in $$bar; do \
- case $$i in \
- *.5) foo="$$foo $$i";; \
- esac; done ;\
- for i in $$foo; do \
- x=`echo $$i | sed 's/\.[^.]*$$/.cat5/'`; \
- echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \
- $(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \
- done
-
-dist-cat8-mans:
- @foo='$(man8_MANS)'; \
- bar='$(man_MANS)'; \
- for i in $$bar; do \
- case $$i in \
- *.8) foo="$$foo $$i";; \
- esac; done ;\
- for i in $$foo; do \
- x=`echo $$i | sed 's/\.[^.]*$$/.cat8/'`; \
- echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \
- $(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \
- done
-
-dist-hook: dist-cat1-mans dist-cat3-mans dist-cat5-mans dist-cat8-mans
-
-install-cat-mans:
- $(SHELL) $(top_srcdir)/cf/install-catman.sh install "$(INSTALL_DATA)" "$(mkinstalldirs)" "$(srcdir)" "$(DESTDIR)$(mandir)" '$(CATMANEXT)' $(man_MANS) $(man1_MANS) $(man3_MANS) $(man5_MANS) $(man8_MANS)
-
-uninstall-cat-mans:
- $(SHELL) $(top_srcdir)/cf/install-catman.sh uninstall "$(INSTALL_DATA)" "$(mkinstalldirs)" "$(srcdir)" "$(DESTDIR)$(mandir)" '$(CATMANEXT)' $(man_MANS) $(man1_MANS) $(man3_MANS) $(man5_MANS) $(man8_MANS)
-
-install-data-hook: install-cat-mans
-uninstall-hook: uninstall-cat-mans
-
-.et.h:
- $(COMPILE_ET) $<
-.et.c:
- $(COMPILE_ET) $<
-
-#
-# Useful target for debugging
-#
-
-check-valgrind:
- tobjdir=`cd $(top_builddir) && pwd` ; \
- tsrcdir=`cd $(top_srcdir) && pwd` ; \
- env TESTS_ENVIRONMENT="$${tsrcdir}/cf/maybe-valgrind.sh -s $${tsrcdir} -o $${tobjdir}" make check
-
-#
-# Target to please samba build farm, builds distfiles in-tree.
-# Will break when automake changes...
-#
-
-distdir-in-tree: $(DISTFILES) $(INFO_DEPS)
- list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
- if test "$$subdir" != .; then \
- (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) distdir-in-tree) ; \
- fi ; \
- done
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/appl/ftp/NTMakefile b/appl/ftp/NTMakefile
deleted file mode 100644
index 097379d80bee..000000000000
--- a/appl/ftp/NTMakefile
+++ /dev/null
@@ -1,35 +0,0 @@
-########################################################################
-#
-# Copyright (c) 2009, Secure Endpoints Inc.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# - Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-RELDIR=appl\ftp
-
-!include ../../windows/NTMakefile.w32
-
diff --git a/appl/ftp/common/Makefile.am b/appl/ftp/common/Makefile.am
deleted file mode 100644
index 1b0ebf2bfcb2..000000000000
--- a/appl/ftp/common/Makefile.am
+++ /dev/null
@@ -1,14 +0,0 @@
-# $Id$
-
-include $(top_srcdir)/Makefile.am.common
-
-AM_CPPFLAGS += $(INCLUDE_krb4)
-
-noinst_LIBRARIES = libcommon.a
-
-libcommon_a_SOURCES = \
- sockbuf.c \
- buffer.c \
- common.h
-
-EXTRA_DIST = NTMakefile \ No newline at end of file
diff --git a/appl/ftp/common/Makefile.in b/appl/ftp/common/Makefile.in
deleted file mode 100644
index f3ec619cf3d1..000000000000
--- a/appl/ftp/common/Makefile.in
+++ /dev/null
@@ -1,830 +0,0 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-@SET_MAKE@
-
-# $Id$
-
-# $Id$
-
-# $Id$
-
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
- $(top_srcdir)/Makefile.am.common \
- $(top_srcdir)/cf/Makefile.am.common
-subdir = appl/ftp/common
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/cf/aix.m4 \
- $(top_srcdir)/cf/auth-modules.m4 \
- $(top_srcdir)/cf/broken-getaddrinfo.m4 \
- $(top_srcdir)/cf/broken-glob.m4 \
- $(top_srcdir)/cf/broken-realloc.m4 \
- $(top_srcdir)/cf/broken-snprintf.m4 $(top_srcdir)/cf/broken.m4 \
- $(top_srcdir)/cf/broken2.m4 $(top_srcdir)/cf/c-attribute.m4 \
- $(top_srcdir)/cf/capabilities.m4 \
- $(top_srcdir)/cf/check-compile-et.m4 \
- $(top_srcdir)/cf/check-getpwnam_r-posix.m4 \
- $(top_srcdir)/cf/check-man.m4 \
- $(top_srcdir)/cf/check-netinet-ip-and-tcp.m4 \
- $(top_srcdir)/cf/check-type-extra.m4 \
- $(top_srcdir)/cf/check-var.m4 $(top_srcdir)/cf/check-x.m4 \
- $(top_srcdir)/cf/check-xau.m4 $(top_srcdir)/cf/crypto.m4 \
- $(top_srcdir)/cf/db.m4 $(top_srcdir)/cf/destdirs.m4 \
- $(top_srcdir)/cf/dispatch.m4 $(top_srcdir)/cf/dlopen.m4 \
- $(top_srcdir)/cf/find-func-no-libs.m4 \
- $(top_srcdir)/cf/find-func-no-libs2.m4 \
- $(top_srcdir)/cf/find-func.m4 \
- $(top_srcdir)/cf/find-if-not-broken.m4 \
- $(top_srcdir)/cf/framework-security.m4 \
- $(top_srcdir)/cf/have-struct-field.m4 \
- $(top_srcdir)/cf/have-type.m4 $(top_srcdir)/cf/irix.m4 \
- $(top_srcdir)/cf/krb-bigendian.m4 \
- $(top_srcdir)/cf/krb-func-getlogin.m4 \
- $(top_srcdir)/cf/krb-ipv6.m4 $(top_srcdir)/cf/krb-prog-ln-s.m4 \
- $(top_srcdir)/cf/krb-readline.m4 \
- $(top_srcdir)/cf/krb-struct-spwd.m4 \
- $(top_srcdir)/cf/krb-struct-winsize.m4 \
- $(top_srcdir)/cf/largefile.m4 $(top_srcdir)/cf/libtool.m4 \
- $(top_srcdir)/cf/ltoptions.m4 $(top_srcdir)/cf/ltsugar.m4 \
- $(top_srcdir)/cf/ltversion.m4 $(top_srcdir)/cf/lt~obsolete.m4 \
- $(top_srcdir)/cf/mips-abi.m4 $(top_srcdir)/cf/misc.m4 \
- $(top_srcdir)/cf/need-proto.m4 $(top_srcdir)/cf/osfc2.m4 \
- $(top_srcdir)/cf/otp.m4 $(top_srcdir)/cf/pkg.m4 \
- $(top_srcdir)/cf/proto-compat.m4 $(top_srcdir)/cf/pthreads.m4 \
- $(top_srcdir)/cf/resolv.m4 $(top_srcdir)/cf/retsigtype.m4 \
- $(top_srcdir)/cf/roken-frag.m4 \
- $(top_srcdir)/cf/socket-wrapper.m4 $(top_srcdir)/cf/sunos.m4 \
- $(top_srcdir)/cf/telnet.m4 $(top_srcdir)/cf/test-package.m4 \
- $(top_srcdir)/cf/version-script.m4 $(top_srcdir)/cf/wflags.m4 \
- $(top_srcdir)/cf/win32.m4 $(top_srcdir)/cf/with-all.m4 \
- $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
- $(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/include/config.h
-CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
-LIBRARIES = $(noinst_LIBRARIES)
-ARFLAGS = cru
-libcommon_a_AR = $(AR) $(ARFLAGS)
-libcommon_a_LIBADD =
-am_libcommon_a_OBJECTS = sockbuf.$(OBJEXT) buffer.$(OBJEXT)
-libcommon_a_OBJECTS = $(am_libcommon_a_OBJECTS)
-depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
-am__mv = mv -f
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
-SOURCES = $(libcommon_a_SOURCES)
-DIST_SOURCES = $(libcommon_a_SOURCES)
-ETAGS = etags
-CTAGS = ctags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AIX_EXTRA_KAFS = @AIX_EXTRA_KAFS@
-AMTAR = @AMTAR@
-AR = @AR@
-ASN1_COMPILE = @ASN1_COMPILE@
-ASN1_COMPILE_DEP = @ASN1_COMPILE_DEP@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CANONICAL_HOST = @CANONICAL_HOST@
-CAPNG_CFLAGS = @CAPNG_CFLAGS@
-CAPNG_LIBS = @CAPNG_LIBS@
-CATMAN = @CATMAN@
-CATMANEXT = @CATMANEXT@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-COMPILE_ET = @COMPILE_ET@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DBHEADER = @DBHEADER@
-DBLIB = @DBLIB@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DIR_com_err = @DIR_com_err@
-DIR_hcrypto = @DIR_hcrypto@
-DIR_hdbdir = @DIR_hdbdir@
-DIR_roken = @DIR_roken@
-DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-FGREP = @FGREP@
-GREP = @GREP@
-GROFF = @GROFF@
-INCLUDES_roken = @INCLUDES_roken@
-INCLUDE_hcrypto = @INCLUDE_hcrypto@
-INCLUDE_hesiod = @INCLUDE_hesiod@
-INCLUDE_krb4 = @INCLUDE_krb4@
-INCLUDE_libedit = @INCLUDE_libedit@
-INCLUDE_libintl = @INCLUDE_libintl@
-INCLUDE_openldap = @INCLUDE_openldap@
-INCLUDE_readline = @INCLUDE_readline@
-INCLUDE_sqlite3 = @INCLUDE_sqlite3@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LDFLAGS_VERSION_SCRIPT = @LDFLAGS_VERSION_SCRIPT@
-LEX = @LEX@
-LEXLIB = @LEXLIB@
-LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
-LIBADD_roken = @LIBADD_roken@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIB_AUTH_SUBDIRS = @LIB_AUTH_SUBDIRS@
-LIB_NDBM = @LIB_NDBM@
-LIB_XauFileName = @LIB_XauFileName@
-LIB_XauReadAuth = @LIB_XauReadAuth@
-LIB_XauWriteAuth = @LIB_XauWriteAuth@
-LIB_bswap16 = @LIB_bswap16@
-LIB_bswap32 = @LIB_bswap32@
-LIB_com_err = @LIB_com_err@
-LIB_com_err_a = @LIB_com_err_a@
-LIB_com_err_so = @LIB_com_err_so@
-LIB_crypt = @LIB_crypt@
-LIB_db_create = @LIB_db_create@
-LIB_dbm_firstkey = @LIB_dbm_firstkey@
-LIB_dbopen = @LIB_dbopen@
-LIB_dispatch_async_f = @LIB_dispatch_async_f@
-LIB_dlopen = @LIB_dlopen@
-LIB_dn_expand = @LIB_dn_expand@
-LIB_dns_search = @LIB_dns_search@
-LIB_door_create = @LIB_door_create@
-LIB_freeaddrinfo = @LIB_freeaddrinfo@
-LIB_gai_strerror = @LIB_gai_strerror@
-LIB_getaddrinfo = @LIB_getaddrinfo@
-LIB_gethostbyname = @LIB_gethostbyname@
-LIB_gethostbyname2 = @LIB_gethostbyname2@
-LIB_getnameinfo = @LIB_getnameinfo@
-LIB_getpwnam_r = @LIB_getpwnam_r@
-LIB_getsockopt = @LIB_getsockopt@
-LIB_hcrypto = @LIB_hcrypto@
-LIB_hcrypto_a = @LIB_hcrypto_a@
-LIB_hcrypto_appl = @LIB_hcrypto_appl@
-LIB_hcrypto_so = @LIB_hcrypto_so@
-LIB_hesiod = @LIB_hesiod@
-LIB_hstrerror = @LIB_hstrerror@
-LIB_kdb = @LIB_kdb@
-LIB_krb4 = @LIB_krb4@
-LIB_libedit = @LIB_libedit@
-LIB_libintl = @LIB_libintl@
-LIB_loadquery = @LIB_loadquery@
-LIB_logout = @LIB_logout@
-LIB_logwtmp = @LIB_logwtmp@
-LIB_openldap = @LIB_openldap@
-LIB_openpty = @LIB_openpty@
-LIB_otp = @LIB_otp@
-LIB_pidfile = @LIB_pidfile@
-LIB_readline = @LIB_readline@
-LIB_res_ndestroy = @LIB_res_ndestroy@
-LIB_res_nsearch = @LIB_res_nsearch@
-LIB_res_search = @LIB_res_search@
-LIB_roken = @LIB_roken@
-LIB_security = @LIB_security@
-LIB_setsockopt = @LIB_setsockopt@
-LIB_socket = @LIB_socket@
-LIB_sqlite3 = @LIB_sqlite3@
-LIB_syslog = @LIB_syslog@
-LIB_tgetent = @LIB_tgetent@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
-NO_AFS = @NO_AFS@
-NROFF = @NROFF@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PKG_CONFIG = @PKG_CONFIG@
-PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
-PTHREAD_LDADD = @PTHREAD_LDADD@
-PTHREAD_LIBADD = @PTHREAD_LIBADD@
-RANLIB = @RANLIB@
-SED = @SED@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-SLC = @SLC@
-SLC_DEP = @SLC_DEP@
-STRIP = @STRIP@
-VERSION = @VERSION@
-VERSIONING = @VERSIONING@
-WFLAGS = @WFLAGS@
-WFLAGS_NOIMPLICITINT = @WFLAGS_NOIMPLICITINT@
-WFLAGS_NOUNUSED = @WFLAGS_NOUNUSED@
-XMKMF = @XMKMF@
-X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
-X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
-YACC = @YACC@
-YFLAGS = @YFLAGS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dpagaix_cflags = @dpagaix_cflags@
-dpagaix_ldadd = @dpagaix_ldadd@
-dpagaix_ldflags = @dpagaix_ldflags@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-subdirs = @subdirs@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-SUFFIXES = .et .h .x .z .hx .1 .3 .5 .8 .cat1 .cat3 .cat5 .cat8
-DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_srcdir)/include
-AM_CPPFLAGS = $(INCLUDES_roken) $(INCLUDE_krb4)
-@do_roken_rename_TRUE@ROKEN_RENAME = -DROKEN_RENAME
-AM_CFLAGS = $(WFLAGS)
-CP = cp
-buildinclude = $(top_builddir)/include
-LIB_el_init = @LIB_el_init@
-LIB_getattr = @LIB_getattr@
-LIB_getpwent_r = @LIB_getpwent_r@
-LIB_odm_initialize = @LIB_odm_initialize@
-LIB_setpcred = @LIB_setpcred@
-HESIODLIB = @HESIODLIB@
-HESIODINCLUDE = @HESIODINCLUDE@
-libexec_heimdaldir = $(libexecdir)/heimdal
-NROFF_MAN = groff -mandoc -Tascii
-LIB_kafs = $(top_builddir)/lib/kafs/libkafs.la $(AIX_EXTRA_KAFS)
-@KRB5_TRUE@LIB_krb5 = $(top_builddir)/lib/krb5/libkrb5.la \
-@KRB5_TRUE@ $(top_builddir)/lib/asn1/libasn1.la
-
-@KRB5_TRUE@LIB_gssapi = $(top_builddir)/lib/gssapi/libgssapi.la
-LIB_heimbase = $(top_builddir)/base/libheimbase.la
-@DCE_TRUE@LIB_kdfs = $(top_builddir)/lib/kdfs/libkdfs.la
-noinst_LIBRARIES = libcommon.a
-libcommon_a_SOURCES = \
- sockbuf.c \
- buffer.c \
- common.h
-
-EXTRA_DIST = NTMakefile
-all: all-am
-
-.SUFFIXES:
-.SUFFIXES: .et .h .x .z .hx .1 .3 .5 .8 .cat1 .cat3 .cat5 .cat8 .c .lo .o .obj
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.am.common $(top_srcdir)/cf/Makefile.am.common $(am__configure_deps)
- @for dep in $?; do \
- case '$(am__configure_deps)' in \
- *$$dep*) \
- ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
- && { if test -f $@; then exit 0; else break; fi; }; \
- exit 1;; \
- esac; \
- done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign appl/ftp/common/Makefile'; \
- $(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --foreign appl/ftp/common/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- @case '$?' in \
- *config.status*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
- *) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
- esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
-
-clean-noinstLIBRARIES:
- -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
-libcommon.a: $(libcommon_a_OBJECTS) $(libcommon_a_DEPENDENCIES)
- -rm -f libcommon.a
- $(libcommon_a_AR) libcommon.a $(libcommon_a_OBJECTS) $(libcommon_a_LIBADD)
- $(RANLIB) libcommon.a
-
-mostlyclean-compile:
- -rm -f *.$(OBJEXT)
-
-distclean-compile:
- -rm -f *.tab.c
-
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buffer.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sockbuf.Po@am__quote@
-
-.c.o:
-@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c $<
-
-.c.obj:
-@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
-
-.c.lo:
-@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
-
-mostlyclean-libtool:
- -rm -f *.lo
-
-clean-libtool:
- -rm -rf .libs _libs
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- mkid -fID $$unique
-tags: TAGS
-
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- set x; \
- here=`pwd`; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- shift; \
- if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- if test $$# -gt 0; then \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- "$$@" $$unique; \
- else \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$unique; \
- fi; \
- fi
-ctags: CTAGS
-CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$unique" \
- || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$unique
-
-GTAGS:
- here=`$(am__cd) $(top_builddir) && pwd` \
- && $(am__cd) $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) "$$here"
-
-distclean-tags:
- -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
- if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
- if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d "$(distdir)/$$file"; then \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
- if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
- cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
- else \
- test -f "$(distdir)/$$file" \
- || cp -p $$d/$$file "$(distdir)/$$file" \
- || exit 1; \
- fi; \
- done
- $(MAKE) $(AM_MAKEFLAGS) \
- top_distdir="$(top_distdir)" distdir="$(distdir)" \
- dist-hook
-check-am: all-am
- $(MAKE) $(AM_MAKEFLAGS) check-local
-check: check-am
-all-am: Makefile $(LIBRARIES) all-local
-installdirs:
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
- -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-
-maintainer-clean-generic:
- @echo "This command is intended for maintainers to use"
- @echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
- mostlyclean-am
-
-distclean: distclean-am
- -rm -rf ./$(DEPDIR)
- -rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
- distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-html-am:
-
-info: info-am
-
-info-am:
-
-install-data-am:
- @$(NORMAL_INSTALL)
- $(MAKE) $(AM_MAKEFLAGS) install-data-hook
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
-install-exec-am:
- @$(NORMAL_INSTALL)
- $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
-install-html: install-html-am
-
-install-html-am:
-
-install-info: install-info-am
-
-install-info-am:
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
- -rm -rf ./$(DEPDIR)
- -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
- mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am:
- @$(NORMAL_INSTALL)
- $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
-.MAKE: check-am install-am install-data-am install-exec-am \
- install-strip uninstall-am
-
-.PHONY: CTAGS GTAGS all all-am all-local check check-am check-local \
- clean clean-generic clean-libtool clean-noinstLIBRARIES ctags \
- dist-hook distclean distclean-compile distclean-generic \
- distclean-libtool distclean-tags distdir dvi dvi-am html \
- html-am info info-am install install-am install-data \
- install-data-am install-data-hook install-dvi install-dvi-am \
- install-exec install-exec-am install-exec-hook install-html \
- install-html-am install-info install-info-am install-man \
- install-pdf install-pdf-am install-ps install-ps-am \
- install-strip installcheck installcheck-am installdirs \
- maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
- pdf pdf-am ps ps-am tags uninstall uninstall-am uninstall-hook
-
-
-install-suid-programs:
- @foo='$(bin_SUIDS)'; \
- for file in $$foo; do \
- x=$(DESTDIR)$(bindir)/$$file; \
- if chown 0:0 $$x && chmod u+s $$x; then :; else \
- echo "*"; \
- echo "* Failed to install $$x setuid root"; \
- echo "*"; \
- fi; done
-
-install-exec-hook: install-suid-programs
-
-install-build-headers:: $(include_HEADERS) $(dist_include_HEADERS) $(nodist_include_HEADERS) $(build_HEADERZ) $(nobase_include_HEADERS)
- @foo='$(include_HEADERS) $(dist_include_HEADERS) $(nodist_include_HEADERS) $(build_HEADERZ)'; \
- for f in $$foo; do \
- f=`basename $$f`; \
- if test -f "$(srcdir)/$$f"; then file="$(srcdir)/$$f"; \
- else file="$$f"; fi; \
- if cmp -s $$file $(buildinclude)/$$f 2> /dev/null ; then \
- : ; else \
- echo " $(CP) $$file $(buildinclude)/$$f"; \
- $(CP) $$file $(buildinclude)/$$f; \
- fi ; \
- done ; \
- foo='$(nobase_include_HEADERS)'; \
- for f in $$foo; do \
- if test -f "$(srcdir)/$$f"; then file="$(srcdir)/$$f"; \
- else file="$$f"; fi; \
- $(mkdir_p) $(buildinclude)/`dirname $$f` ; \
- if cmp -s $$file $(buildinclude)/$$f 2> /dev/null ; then \
- : ; else \
- echo " $(CP) $$file $(buildinclude)/$$f"; \
- $(CP) $$file $(buildinclude)/$$f; \
- fi ; \
- done
-
-all-local: install-build-headers
-
-check-local::
- @if test '$(CHECK_LOCAL)' = "no-check-local"; then \
- foo=''; elif test '$(CHECK_LOCAL)'; then \
- foo='$(CHECK_LOCAL)'; else \
- foo='$(PROGRAMS)'; fi; \
- if test "$$foo"; then \
- failed=0; all=0; \
- for i in $$foo; do \
- all=`expr $$all + 1`; \
- if (./$$i --version && ./$$i --help) > /dev/null 2>&1; then \
- echo "PASS: $$i"; \
- else \
- echo "FAIL: $$i"; \
- failed=`expr $$failed + 1`; \
- fi; \
- done; \
- if test "$$failed" -eq 0; then \
- banner="All $$all tests passed"; \
- else \
- banner="$$failed of $$all tests failed"; \
- fi; \
- dashes=`echo "$$banner" | sed s/./=/g`; \
- echo "$$dashes"; \
- echo "$$banner"; \
- echo "$$dashes"; \
- test "$$failed" -eq 0 || exit 1; \
- fi
-
-.x.c:
- @cmp -s $< $@ 2> /dev/null || cp $< $@
-
-.hx.h:
- @cmp -s $< $@ 2> /dev/null || cp $< $@
-#NROFF_MAN = nroff -man
-.1.cat1:
- $(NROFF_MAN) $< > $@
-.3.cat3:
- $(NROFF_MAN) $< > $@
-.5.cat5:
- $(NROFF_MAN) $< > $@
-.8.cat8:
- $(NROFF_MAN) $< > $@
-
-dist-cat1-mans:
- @foo='$(man1_MANS)'; \
- bar='$(man_MANS)'; \
- for i in $$bar; do \
- case $$i in \
- *.1) foo="$$foo $$i";; \
- esac; done ;\
- for i in $$foo; do \
- x=`echo $$i | sed 's/\.[^.]*$$/.cat1/'`; \
- echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \
- $(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \
- done
-
-dist-cat3-mans:
- @foo='$(man3_MANS)'; \
- bar='$(man_MANS)'; \
- for i in $$bar; do \
- case $$i in \
- *.3) foo="$$foo $$i";; \
- esac; done ;\
- for i in $$foo; do \
- x=`echo $$i | sed 's/\.[^.]*$$/.cat3/'`; \
- echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \
- $(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \
- done
-
-dist-cat5-mans:
- @foo='$(man5_MANS)'; \
- bar='$(man_MANS)'; \
- for i in $$bar; do \
- case $$i in \
- *.5) foo="$$foo $$i";; \
- esac; done ;\
- for i in $$foo; do \
- x=`echo $$i | sed 's/\.[^.]*$$/.cat5/'`; \
- echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \
- $(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \
- done
-
-dist-cat8-mans:
- @foo='$(man8_MANS)'; \
- bar='$(man_MANS)'; \
- for i in $$bar; do \
- case $$i in \
- *.8) foo="$$foo $$i";; \
- esac; done ;\
- for i in $$foo; do \
- x=`echo $$i | sed 's/\.[^.]*$$/.cat8/'`; \
- echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \
- $(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \
- done
-
-dist-hook: dist-cat1-mans dist-cat3-mans dist-cat5-mans dist-cat8-mans
-
-install-cat-mans:
- $(SHELL) $(top_srcdir)/cf/install-catman.sh install "$(INSTALL_DATA)" "$(mkinstalldirs)" "$(srcdir)" "$(DESTDIR)$(mandir)" '$(CATMANEXT)' $(man_MANS) $(man1_MANS) $(man3_MANS) $(man5_MANS) $(man8_MANS)
-
-uninstall-cat-mans:
- $(SHELL) $(top_srcdir)/cf/install-catman.sh uninstall "$(INSTALL_DATA)" "$(mkinstalldirs)" "$(srcdir)" "$(DESTDIR)$(mandir)" '$(CATMANEXT)' $(man_MANS) $(man1_MANS) $(man3_MANS) $(man5_MANS) $(man8_MANS)
-
-install-data-hook: install-cat-mans
-uninstall-hook: uninstall-cat-mans
-
-.et.h:
- $(COMPILE_ET) $<
-.et.c:
- $(COMPILE_ET) $<
-
-#
-# Useful target for debugging
-#
-
-check-valgrind:
- tobjdir=`cd $(top_builddir) && pwd` ; \
- tsrcdir=`cd $(top_srcdir) && pwd` ; \
- env TESTS_ENVIRONMENT="$${tsrcdir}/cf/maybe-valgrind.sh -s $${tsrcdir} -o $${tobjdir}" make check
-
-#
-# Target to please samba build farm, builds distfiles in-tree.
-# Will break when automake changes...
-#
-
-distdir-in-tree: $(DISTFILES) $(INFO_DEPS)
- list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
- if test "$$subdir" != .; then \
- (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) distdir-in-tree) ; \
- fi ; \
- done
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/appl/ftp/common/NTMakefile b/appl/ftp/common/NTMakefile
deleted file mode 100644
index 8f61c745f315..000000000000
--- a/appl/ftp/common/NTMakefile
+++ /dev/null
@@ -1,35 +0,0 @@
-########################################################################
-#
-# Copyright (c) 2009, Secure Endpoints Inc.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# - Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-RELDIR=appl\ftp\common
-
-!include ../../../windows/NTMakefile.w32
-
diff --git a/appl/ftp/common/buffer.c b/appl/ftp/common/buffer.c
deleted file mode 100644
index fca90ce31b01..000000000000
--- a/appl/ftp/common/buffer.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 1995-2000 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the Institute nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "common.h"
-#include <stdio.h>
-#include <err.h>
-#include "roken.h"
-
-RCSID("$Id$");
-
-/*
- * Allocate a buffer enough to handle st->st_blksize, if
- * there is such a field, otherwise BUFSIZ.
- */
-
-void *
-alloc_buffer (void *oldbuf, size_t *sz, struct stat *st)
-{
- size_t new_sz;
-
- new_sz = BUFSIZ;
-#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
- if (st)
- new_sz = max(BUFSIZ, st->st_blksize);
-#endif
- if(new_sz > *sz) {
- if (oldbuf)
- free (oldbuf);
- oldbuf = malloc (new_sz);
- if (oldbuf == NULL) {
- warn ("malloc");
- *sz = 0;
- return NULL;
- }
- *sz = new_sz;
- }
- return oldbuf;
-}
-
diff --git a/appl/ftp/common/common.h b/appl/ftp/common/common.h
deleted file mode 100644
index e6621dd685ff..000000000000
--- a/appl/ftp/common/common.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the Institute nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/* $Id$ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifndef __COMMON_H__
-#define __COMMON_H__
-
-#include "base64.h"
-
-void set_buffer_size(int, int);
-
-#include <stdlib.h>
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-
-void *alloc_buffer (void *oldbuf, size_t *sz, struct stat *st);
-
-#endif /* __COMMON_H__ */
diff --git a/appl/ftp/common/sockbuf.c b/appl/ftp/common/sockbuf.c
deleted file mode 100644
index bb2a5fd7905c..000000000000
--- a/appl/ftp/common/sockbuf.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the Institute nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "common.h"
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-
-RCSID("$Id$");
-
-void
-set_buffer_size(int fd, int read)
-{
-#if defined(SO_RCVBUF) && defined(SO_SNDBUF) && defined(HAVE_SETSOCKOPT)
- int size = 4194304;
- int optname = read ? SO_RCVBUF : SO_SNDBUF;
-
-#ifdef HAVE_GETSOCKOPT
- int curr=0;
- socklen_t optlen;
-
- optlen = sizeof(curr);
- if(getsockopt(fd, SOL_SOCKET, optname, (void *)&curr, &optlen) == 0) {
- if(curr >= size) {
- /* Already large enough */
- return;
- }
- }
-#endif /* HAVE_GETSOCKOPT */
-
- while(size >= 131072 &&
- setsockopt(fd, SOL_SOCKET, optname, (void *)&size, sizeof(size)) < 0)
- size /= 2;
-#endif
-}
-
-
diff --git a/appl/ftp/ftp/Makefile.am b/appl/ftp/ftp/Makefile.am
deleted file mode 100644
index e47580dfc182..000000000000
--- a/appl/ftp/ftp/Makefile.am
+++ /dev/null
@@ -1,44 +0,0 @@
-# $Id$
-
-include $(top_srcdir)/Makefile.am.common
-
-AM_CPPFLAGS += -I$(srcdir)/../common $(INCLUDE_readline) $(INCLUDE_hcrypto)
-
-bin_PROGRAMS = ftp
-
-CHECK_LOCAL =
-
-if KRB5
-krb5_sources = gssapi.c
-endif
-
-ftp_SOURCES = \
- cmds.c \
- cmdtab.c \
- extern.h \
- ftp.c \
- ftp_locl.h \
- ftp_var.h \
- main.c \
- pathnames.h \
- ruserpass.c \
- domacro.c \
- globals.c \
- security.c \
- security.h \
- kauth.c \
- $(krb5_sources)
-
-EXTRA_ftp_SOURCES = gssapi.c
-
-man_MANS = ftp.1
-
-LDADD = \
- ../common/libcommon.a \
- $(LIB_gssapi) \
- $(LIB_krb5) \
- $(LIB_hcrypto) \
- $(LIB_roken) \
- $(LIB_readline)
-
-EXTRA_DIST = NTMakefile $(man_MANS)
diff --git a/appl/ftp/ftp/Makefile.in b/appl/ftp/ftp/Makefile.in
deleted file mode 100644
index bd3810b36886..000000000000
--- a/appl/ftp/ftp/Makefile.in
+++ /dev/null
@@ -1,992 +0,0 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-@SET_MAKE@
-
-# $Id$
-
-# $Id$
-
-# $Id$
-
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
- $(top_srcdir)/Makefile.am.common \
- $(top_srcdir)/cf/Makefile.am.common
-bin_PROGRAMS = ftp$(EXEEXT)
-subdir = appl/ftp/ftp
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/cf/aix.m4 \
- $(top_srcdir)/cf/auth-modules.m4 \
- $(top_srcdir)/cf/broken-getaddrinfo.m4 \
- $(top_srcdir)/cf/broken-glob.m4 \
- $(top_srcdir)/cf/broken-realloc.m4 \
- $(top_srcdir)/cf/broken-snprintf.m4 $(top_srcdir)/cf/broken.m4 \
- $(top_srcdir)/cf/broken2.m4 $(top_srcdir)/cf/c-attribute.m4 \
- $(top_srcdir)/cf/capabilities.m4 \
- $(top_srcdir)/cf/check-compile-et.m4 \
- $(top_srcdir)/cf/check-getpwnam_r-posix.m4 \
- $(top_srcdir)/cf/check-man.m4 \
- $(top_srcdir)/cf/check-netinet-ip-and-tcp.m4 \
- $(top_srcdir)/cf/check-type-extra.m4 \
- $(top_srcdir)/cf/check-var.m4 $(top_srcdir)/cf/check-x.m4 \
- $(top_srcdir)/cf/check-xau.m4 $(top_srcdir)/cf/crypto.m4 \
- $(top_srcdir)/cf/db.m4 $(top_srcdir)/cf/destdirs.m4 \
- $(top_srcdir)/cf/dispatch.m4 $(top_srcdir)/cf/dlopen.m4 \
- $(top_srcdir)/cf/find-func-no-libs.m4 \
- $(top_srcdir)/cf/find-func-no-libs2.m4 \
- $(top_srcdir)/cf/find-func.m4 \
- $(top_srcdir)/cf/find-if-not-broken.m4 \
- $(top_srcdir)/cf/framework-security.m4 \
- $(top_srcdir)/cf/have-struct-field.m4 \
- $(top_srcdir)/cf/have-type.m4 $(top_srcdir)/cf/irix.m4 \
- $(top_srcdir)/cf/krb-bigendian.m4 \
- $(top_srcdir)/cf/krb-func-getlogin.m4 \
- $(top_srcdir)/cf/krb-ipv6.m4 $(top_srcdir)/cf/krb-prog-ln-s.m4 \
- $(top_srcdir)/cf/krb-readline.m4 \
- $(top_srcdir)/cf/krb-struct-spwd.m4 \
- $(top_srcdir)/cf/krb-struct-winsize.m4 \
- $(top_srcdir)/cf/largefile.m4 $(top_srcdir)/cf/libtool.m4 \
- $(top_srcdir)/cf/ltoptions.m4 $(top_srcdir)/cf/ltsugar.m4 \
- $(top_srcdir)/cf/ltversion.m4 $(top_srcdir)/cf/lt~obsolete.m4 \
- $(top_srcdir)/cf/mips-abi.m4 $(top_srcdir)/cf/misc.m4 \
- $(top_srcdir)/cf/need-proto.m4 $(top_srcdir)/cf/osfc2.m4 \
- $(top_srcdir)/cf/otp.m4 $(top_srcdir)/cf/pkg.m4 \
- $(top_srcdir)/cf/proto-compat.m4 $(top_srcdir)/cf/pthreads.m4 \
- $(top_srcdir)/cf/resolv.m4 $(top_srcdir)/cf/retsigtype.m4 \
- $(top_srcdir)/cf/roken-frag.m4 \
- $(top_srcdir)/cf/socket-wrapper.m4 $(top_srcdir)/cf/sunos.m4 \
- $(top_srcdir)/cf/telnet.m4 $(top_srcdir)/cf/test-package.m4 \
- $(top_srcdir)/cf/version-script.m4 $(top_srcdir)/cf/wflags.m4 \
- $(top_srcdir)/cf/win32.m4 $(top_srcdir)/cf/with-all.m4 \
- $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
- $(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/include/config.h
-CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
-am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
-PROGRAMS = $(bin_PROGRAMS)
-am__ftp_SOURCES_DIST = cmds.c cmdtab.c extern.h ftp.c ftp_locl.h \
- ftp_var.h main.c pathnames.h ruserpass.c domacro.c globals.c \
- security.c security.h kauth.c gssapi.c
-@KRB5_TRUE@am__objects_1 = gssapi.$(OBJEXT)
-am_ftp_OBJECTS = cmds.$(OBJEXT) cmdtab.$(OBJEXT) ftp.$(OBJEXT) \
- main.$(OBJEXT) ruserpass.$(OBJEXT) domacro.$(OBJEXT) \
- globals.$(OBJEXT) security.$(OBJEXT) kauth.$(OBJEXT) \
- $(am__objects_1)
-ftp_OBJECTS = $(am_ftp_OBJECTS)
-ftp_LDADD = $(LDADD)
-am__DEPENDENCIES_1 =
-ftp_DEPENDENCIES = ../common/libcommon.a $(LIB_gssapi) $(LIB_krb5) \
- $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_1)
-depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
-am__mv = mv -f
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
-SOURCES = $(ftp_SOURCES) $(EXTRA_ftp_SOURCES)
-DIST_SOURCES = $(am__ftp_SOURCES_DIST) $(EXTRA_ftp_SOURCES)
-am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
-am__vpath_adj = case $$p in \
- $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
- *) f=$$p;; \
- esac;
-am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
-am__install_max = 40
-am__nobase_strip_setup = \
- srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
-am__nobase_strip = \
- for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
-am__nobase_list = $(am__nobase_strip_setup); \
- for p in $$list; do echo "$$p $$p"; done | \
- sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
- $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
- if (++n[$$2] == $(am__install_max)) \
- { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
- END { for (dir in files) print dir, files[dir] }'
-am__base_list = \
- sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
- sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-man1dir = $(mandir)/man1
-MANS = $(man_MANS)
-ETAGS = etags
-CTAGS = ctags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AIX_EXTRA_KAFS = @AIX_EXTRA_KAFS@
-AMTAR = @AMTAR@
-AR = @AR@
-ASN1_COMPILE = @ASN1_COMPILE@
-ASN1_COMPILE_DEP = @ASN1_COMPILE_DEP@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CANONICAL_HOST = @CANONICAL_HOST@
-CAPNG_CFLAGS = @CAPNG_CFLAGS@
-CAPNG_LIBS = @CAPNG_LIBS@
-CATMAN = @CATMAN@
-CATMANEXT = @CATMANEXT@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-COMPILE_ET = @COMPILE_ET@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DBHEADER = @DBHEADER@
-DBLIB = @DBLIB@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DIR_com_err = @DIR_com_err@
-DIR_hcrypto = @DIR_hcrypto@
-DIR_hdbdir = @DIR_hdbdir@
-DIR_roken = @DIR_roken@
-DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-FGREP = @FGREP@
-GREP = @GREP@
-GROFF = @GROFF@
-INCLUDES_roken = @INCLUDES_roken@
-INCLUDE_hcrypto = @INCLUDE_hcrypto@
-INCLUDE_hesiod = @INCLUDE_hesiod@
-INCLUDE_krb4 = @INCLUDE_krb4@
-INCLUDE_libedit = @INCLUDE_libedit@
-INCLUDE_libintl = @INCLUDE_libintl@
-INCLUDE_openldap = @INCLUDE_openldap@
-INCLUDE_readline = @INCLUDE_readline@
-INCLUDE_sqlite3 = @INCLUDE_sqlite3@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LDFLAGS_VERSION_SCRIPT = @LDFLAGS_VERSION_SCRIPT@
-LEX = @LEX@
-LEXLIB = @LEXLIB@
-LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
-LIBADD_roken = @LIBADD_roken@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIB_AUTH_SUBDIRS = @LIB_AUTH_SUBDIRS@
-LIB_NDBM = @LIB_NDBM@
-LIB_XauFileName = @LIB_XauFileName@
-LIB_XauReadAuth = @LIB_XauReadAuth@
-LIB_XauWriteAuth = @LIB_XauWriteAuth@
-LIB_bswap16 = @LIB_bswap16@
-LIB_bswap32 = @LIB_bswap32@
-LIB_com_err = @LIB_com_err@
-LIB_com_err_a = @LIB_com_err_a@
-LIB_com_err_so = @LIB_com_err_so@
-LIB_crypt = @LIB_crypt@
-LIB_db_create = @LIB_db_create@
-LIB_dbm_firstkey = @LIB_dbm_firstkey@
-LIB_dbopen = @LIB_dbopen@
-LIB_dispatch_async_f = @LIB_dispatch_async_f@
-LIB_dlopen = @LIB_dlopen@
-LIB_dn_expand = @LIB_dn_expand@
-LIB_dns_search = @LIB_dns_search@
-LIB_door_create = @LIB_door_create@
-LIB_freeaddrinfo = @LIB_freeaddrinfo@
-LIB_gai_strerror = @LIB_gai_strerror@
-LIB_getaddrinfo = @LIB_getaddrinfo@
-LIB_gethostbyname = @LIB_gethostbyname@
-LIB_gethostbyname2 = @LIB_gethostbyname2@
-LIB_getnameinfo = @LIB_getnameinfo@
-LIB_getpwnam_r = @LIB_getpwnam_r@
-LIB_getsockopt = @LIB_getsockopt@
-LIB_hcrypto = @LIB_hcrypto@
-LIB_hcrypto_a = @LIB_hcrypto_a@
-LIB_hcrypto_appl = @LIB_hcrypto_appl@
-LIB_hcrypto_so = @LIB_hcrypto_so@
-LIB_hesiod = @LIB_hesiod@
-LIB_hstrerror = @LIB_hstrerror@
-LIB_kdb = @LIB_kdb@
-LIB_krb4 = @LIB_krb4@
-LIB_libedit = @LIB_libedit@
-LIB_libintl = @LIB_libintl@
-LIB_loadquery = @LIB_loadquery@
-LIB_logout = @LIB_logout@
-LIB_logwtmp = @LIB_logwtmp@
-LIB_openldap = @LIB_openldap@
-LIB_openpty = @LIB_openpty@
-LIB_otp = @LIB_otp@
-LIB_pidfile = @LIB_pidfile@
-LIB_readline = @LIB_readline@
-LIB_res_ndestroy = @LIB_res_ndestroy@
-LIB_res_nsearch = @LIB_res_nsearch@
-LIB_res_search = @LIB_res_search@
-LIB_roken = @LIB_roken@
-LIB_security = @LIB_security@
-LIB_setsockopt = @LIB_setsockopt@
-LIB_socket = @LIB_socket@
-LIB_sqlite3 = @LIB_sqlite3@
-LIB_syslog = @LIB_syslog@
-LIB_tgetent = @LIB_tgetent@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
-NO_AFS = @NO_AFS@
-NROFF = @NROFF@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PKG_CONFIG = @PKG_CONFIG@
-PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
-PTHREAD_LDADD = @PTHREAD_LDADD@
-PTHREAD_LIBADD = @PTHREAD_LIBADD@
-RANLIB = @RANLIB@
-SED = @SED@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-SLC = @SLC@
-SLC_DEP = @SLC_DEP@
-STRIP = @STRIP@
-VERSION = @VERSION@
-VERSIONING = @VERSIONING@
-WFLAGS = @WFLAGS@
-WFLAGS_NOIMPLICITINT = @WFLAGS_NOIMPLICITINT@
-WFLAGS_NOUNUSED = @WFLAGS_NOUNUSED@
-XMKMF = @XMKMF@
-X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
-X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
-YACC = @YACC@
-YFLAGS = @YFLAGS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dpagaix_cflags = @dpagaix_cflags@
-dpagaix_ldadd = @dpagaix_ldadd@
-dpagaix_ldflags = @dpagaix_ldflags@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-subdirs = @subdirs@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-SUFFIXES = .et .h .x .z .hx .1 .3 .5 .8 .cat1 .cat3 .cat5 .cat8
-DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_srcdir)/include
-AM_CPPFLAGS = $(INCLUDES_roken) -I$(srcdir)/../common \
- $(INCLUDE_readline) $(INCLUDE_hcrypto)
-@do_roken_rename_TRUE@ROKEN_RENAME = -DROKEN_RENAME
-AM_CFLAGS = $(WFLAGS)
-CP = cp
-buildinclude = $(top_builddir)/include
-LIB_el_init = @LIB_el_init@
-LIB_getattr = @LIB_getattr@
-LIB_getpwent_r = @LIB_getpwent_r@
-LIB_odm_initialize = @LIB_odm_initialize@
-LIB_setpcred = @LIB_setpcred@
-HESIODLIB = @HESIODLIB@
-HESIODINCLUDE = @HESIODINCLUDE@
-libexec_heimdaldir = $(libexecdir)/heimdal
-NROFF_MAN = groff -mandoc -Tascii
-LIB_kafs = $(top_builddir)/lib/kafs/libkafs.la $(AIX_EXTRA_KAFS)
-@KRB5_TRUE@LIB_krb5 = $(top_builddir)/lib/krb5/libkrb5.la \
-@KRB5_TRUE@ $(top_builddir)/lib/asn1/libasn1.la
-
-@KRB5_TRUE@LIB_gssapi = $(top_builddir)/lib/gssapi/libgssapi.la
-LIB_heimbase = $(top_builddir)/base/libheimbase.la
-@DCE_TRUE@LIB_kdfs = $(top_builddir)/lib/kdfs/libkdfs.la
-CHECK_LOCAL =
-@KRB5_TRUE@krb5_sources = gssapi.c
-ftp_SOURCES = \
- cmds.c \
- cmdtab.c \
- extern.h \
- ftp.c \
- ftp_locl.h \
- ftp_var.h \
- main.c \
- pathnames.h \
- ruserpass.c \
- domacro.c \
- globals.c \
- security.c \
- security.h \
- kauth.c \
- $(krb5_sources)
-
-EXTRA_ftp_SOURCES = gssapi.c
-man_MANS = ftp.1
-LDADD = \
- ../common/libcommon.a \
- $(LIB_gssapi) \
- $(LIB_krb5) \
- $(LIB_hcrypto) \
- $(LIB_roken) \
- $(LIB_readline)
-
-EXTRA_DIST = NTMakefile $(man_MANS)
-all: all-am
-
-.SUFFIXES:
-.SUFFIXES: .et .h .x .z .hx .1 .3 .5 .8 .cat1 .cat3 .cat5 .cat8 .c .lo .o .obj
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.am.common $(top_srcdir)/cf/Makefile.am.common $(am__configure_deps)
- @for dep in $?; do \
- case '$(am__configure_deps)' in \
- *$$dep*) \
- ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
- && { if test -f $@; then exit 0; else break; fi; }; \
- exit 1;; \
- esac; \
- done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign appl/ftp/ftp/Makefile'; \
- $(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --foreign appl/ftp/ftp/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- @case '$?' in \
- *config.status*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
- *) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
- esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
-install-binPROGRAMS: $(bin_PROGRAMS)
- @$(NORMAL_INSTALL)
- test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
- @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
- for p in $$list; do echo "$$p $$p"; done | \
- sed 's/$(EXEEXT)$$//' | \
- while read p p1; do if test -f $$p || test -f $$p1; \
- then echo "$$p"; echo "$$p"; else :; fi; \
- done | \
- sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
- -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
- sed 'N;N;N;s,\n, ,g' | \
- $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
- { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
- if ($$2 == $$4) files[d] = files[d] " " $$1; \
- else { print "f", $$3 "/" $$4, $$1; } } \
- END { for (d in files) print "f", d, files[d] }' | \
- while read type dir files; do \
- if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
- test -z "$$files" || { \
- echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
- $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
- } \
- ; done
-
-uninstall-binPROGRAMS:
- @$(NORMAL_UNINSTALL)
- @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
- files=`for p in $$list; do echo "$$p"; done | \
- sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
- -e 's/$$/$(EXEEXT)/' `; \
- test -n "$$list" || exit 0; \
- echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
- cd "$(DESTDIR)$(bindir)" && rm -f $$files
-
-clean-binPROGRAMS:
- @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
- echo " rm -f" $$list; \
- rm -f $$list || exit $$?; \
- test -n "$(EXEEXT)" || exit 0; \
- list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
- echo " rm -f" $$list; \
- rm -f $$list
-ftp$(EXEEXT): $(ftp_OBJECTS) $(ftp_DEPENDENCIES)
- @rm -f ftp$(EXEEXT)
- $(LINK) $(ftp_OBJECTS) $(ftp_LDADD) $(LIBS)
-
-mostlyclean-compile:
- -rm -f *.$(OBJEXT)
-
-distclean-compile:
- -rm -f *.tab.c
-
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmds.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmdtab.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/domacro.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftp.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/globals.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gssapi.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kauth.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ruserpass.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/security.Po@am__quote@
-
-.c.o:
-@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c $<
-
-.c.obj:
-@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
-
-.c.lo:
-@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
-
-mostlyclean-libtool:
- -rm -f *.lo
-
-clean-libtool:
- -rm -rf .libs _libs
-install-man1: $(man_MANS)
- @$(NORMAL_INSTALL)
- test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)"
- @list=''; test -n "$(man1dir)" || exit 0; \
- { for i in $$list; do echo "$$i"; done; \
- l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
- sed -n '/\.1[a-z]*$$/p'; \
- } | while read p; do \
- if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
- echo "$$d$$p"; echo "$$p"; \
- done | \
- sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
- -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
- sed 'N;N;s,\n, ,g' | { \
- list=; while read file base inst; do \
- if test "$$base" = "$$inst"; then list="$$list $$file"; else \
- echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
- $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \
- fi; \
- done; \
- for i in $$list; do echo "$$i"; done | $(am__base_list) | \
- while read files; do \
- test -z "$$files" || { \
- echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \
- $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \
- done; }
-
-uninstall-man1:
- @$(NORMAL_UNINSTALL)
- @list=''; test -n "$(man1dir)" || exit 0; \
- files=`{ for i in $$list; do echo "$$i"; done; \
- l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
- sed -n '/\.1[a-z]*$$/p'; \
- } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
- -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
- test -z "$$files" || { \
- echo " ( cd '$(DESTDIR)$(man1dir)' && rm -f" $$files ")"; \
- cd "$(DESTDIR)$(man1dir)" && rm -f $$files; }
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- mkid -fID $$unique
-tags: TAGS
-
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- set x; \
- here=`pwd`; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- shift; \
- if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- if test $$# -gt 0; then \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- "$$@" $$unique; \
- else \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$unique; \
- fi; \
- fi
-ctags: CTAGS
-CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$unique" \
- || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$unique
-
-GTAGS:
- here=`$(am__cd) $(top_builddir) && pwd` \
- && $(am__cd) $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) "$$here"
-
-distclean-tags:
- -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
- @list='$(MANS)'; if test -n "$$list"; then \
- list=`for p in $$list; do \
- if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
- if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
- if test -n "$$list" && \
- grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
- echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \
- grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \
- echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \
- echo " typically \`make maintainer-clean' will remove them" >&2; \
- exit 1; \
- else :; fi; \
- else :; fi
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
- if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
- if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d "$(distdir)/$$file"; then \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
- if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
- cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
- else \
- test -f "$(distdir)/$$file" \
- || cp -p $$d/$$file "$(distdir)/$$file" \
- || exit 1; \
- fi; \
- done
- $(MAKE) $(AM_MAKEFLAGS) \
- top_distdir="$(top_distdir)" distdir="$(distdir)" \
- dist-hook
-check-am: all-am
- $(MAKE) $(AM_MAKEFLAGS) check-local
-check: check-am
-all-am: Makefile $(PROGRAMS) $(MANS) all-local
-installdirs:
- for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \
- test -z "$$dir" || $(MKDIR_P) "$$dir"; \
- done
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
- -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-
-maintainer-clean-generic:
- @echo "This command is intended for maintainers to use"
- @echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
-
-distclean: distclean-am
- -rm -rf ./$(DEPDIR)
- -rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
- distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-html-am:
-
-info: info-am
-
-info-am:
-
-install-data-am: install-man
- @$(NORMAL_INSTALL)
- $(MAKE) $(AM_MAKEFLAGS) install-data-hook
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
-install-exec-am: install-binPROGRAMS
- @$(NORMAL_INSTALL)
- $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
-install-html: install-html-am
-
-install-html-am:
-
-install-info: install-info-am
-
-install-info-am:
-
-install-man: install-man1
-
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
- -rm -rf ./$(DEPDIR)
- -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
- mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am: uninstall-binPROGRAMS uninstall-man
- @$(NORMAL_INSTALL)
- $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
-uninstall-man: uninstall-man1
-
-.MAKE: check-am install-am install-data-am install-exec-am \
- install-strip uninstall-am
-
-.PHONY: CTAGS GTAGS all all-am all-local check check-am check-local \
- clean clean-binPROGRAMS clean-generic clean-libtool ctags \
- dist-hook distclean distclean-compile distclean-generic \
- distclean-libtool distclean-tags distdir dvi dvi-am html \
- html-am info info-am install install-am install-binPROGRAMS \
- install-data install-data-am install-data-hook install-dvi \
- install-dvi-am install-exec install-exec-am install-exec-hook \
- install-html install-html-am install-info install-info-am \
- install-man install-man1 install-pdf install-pdf-am install-ps \
- install-ps-am install-strip installcheck installcheck-am \
- installdirs maintainer-clean maintainer-clean-generic \
- mostlyclean mostlyclean-compile mostlyclean-generic \
- mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
- uninstall-am uninstall-binPROGRAMS uninstall-hook \
- uninstall-man uninstall-man1
-
-
-install-suid-programs:
- @foo='$(bin_SUIDS)'; \
- for file in $$foo; do \
- x=$(DESTDIR)$(bindir)/$$file; \
- if chown 0:0 $$x && chmod u+s $$x; then :; else \
- echo "*"; \
- echo "* Failed to install $$x setuid root"; \
- echo "*"; \
- fi; done
-
-install-exec-hook: install-suid-programs
-
-install-build-headers:: $(include_HEADERS) $(dist_include_HEADERS) $(nodist_include_HEADERS) $(build_HEADERZ) $(nobase_include_HEADERS)
- @foo='$(include_HEADERS) $(dist_include_HEADERS) $(nodist_include_HEADERS) $(build_HEADERZ)'; \
- for f in $$foo; do \
- f=`basename $$f`; \
- if test -f "$(srcdir)/$$f"; then file="$(srcdir)/$$f"; \
- else file="$$f"; fi; \
- if cmp -s $$file $(buildinclude)/$$f 2> /dev/null ; then \
- : ; else \
- echo " $(CP) $$file $(buildinclude)/$$f"; \
- $(CP) $$file $(buildinclude)/$$f; \
- fi ; \
- done ; \
- foo='$(nobase_include_HEADERS)'; \
- for f in $$foo; do \
- if test -f "$(srcdir)/$$f"; then file="$(srcdir)/$$f"; \
- else file="$$f"; fi; \
- $(mkdir_p) $(buildinclude)/`dirname $$f` ; \
- if cmp -s $$file $(buildinclude)/$$f 2> /dev/null ; then \
- : ; else \
- echo " $(CP) $$file $(buildinclude)/$$f"; \
- $(CP) $$file $(buildinclude)/$$f; \
- fi ; \
- done
-
-all-local: install-build-headers
-
-check-local::
- @if test '$(CHECK_LOCAL)' = "no-check-local"; then \
- foo=''; elif test '$(CHECK_LOCAL)'; then \
- foo='$(CHECK_LOCAL)'; else \
- foo='$(PROGRAMS)'; fi; \
- if test "$$foo"; then \
- failed=0; all=0; \
- for i in $$foo; do \
- all=`expr $$all + 1`; \
- if (./$$i --version && ./$$i --help) > /dev/null 2>&1; then \
- echo "PASS: $$i"; \
- else \
- echo "FAIL: $$i"; \
- failed=`expr $$failed + 1`; \
- fi; \
- done; \
- if test "$$failed" -eq 0; then \
- banner="All $$all tests passed"; \
- else \
- banner="$$failed of $$all tests failed"; \
- fi; \
- dashes=`echo "$$banner" | sed s/./=/g`; \
- echo "$$dashes"; \
- echo "$$banner"; \
- echo "$$dashes"; \
- test "$$failed" -eq 0 || exit 1; \
- fi
-
-.x.c:
- @cmp -s $< $@ 2> /dev/null || cp $< $@
-
-.hx.h:
- @cmp -s $< $@ 2> /dev/null || cp $< $@
-#NROFF_MAN = nroff -man
-.1.cat1:
- $(NROFF_MAN) $< > $@
-.3.cat3:
- $(NROFF_MAN) $< > $@
-.5.cat5:
- $(NROFF_MAN) $< > $@
-.8.cat8:
- $(NROFF_MAN) $< > $@
-
-dist-cat1-mans:
- @foo='$(man1_MANS)'; \
- bar='$(man_MANS)'; \
- for i in $$bar; do \
- case $$i in \
- *.1) foo="$$foo $$i";; \
- esac; done ;\
- for i in $$foo; do \
- x=`echo $$i | sed 's/\.[^.]*$$/.cat1/'`; \
- echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \
- $(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \
- done
-
-dist-cat3-mans:
- @foo='$(man3_MANS)'; \
- bar='$(man_MANS)'; \
- for i in $$bar; do \
- case $$i in \
- *.3) foo="$$foo $$i";; \
- esac; done ;\
- for i in $$foo; do \
- x=`echo $$i | sed 's/\.[^.]*$$/.cat3/'`; \
- echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \
- $(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \
- done
-
-dist-cat5-mans:
- @foo='$(man5_MANS)'; \
- bar='$(man_MANS)'; \
- for i in $$bar; do \
- case $$i in \
- *.5) foo="$$foo $$i";; \
- esac; done ;\
- for i in $$foo; do \
- x=`echo $$i | sed 's/\.[^.]*$$/.cat5/'`; \
- echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \
- $(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \
- done
-
-dist-cat8-mans:
- @foo='$(man8_MANS)'; \
- bar='$(man_MANS)'; \
- for i in $$bar; do \
- case $$i in \
- *.8) foo="$$foo $$i";; \
- esac; done ;\
- for i in $$foo; do \
- x=`echo $$i | sed 's/\.[^.]*$$/.cat8/'`; \
- echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \
- $(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \
- done
-
-dist-hook: dist-cat1-mans dist-cat3-mans dist-cat5-mans dist-cat8-mans
-
-install-cat-mans:
- $(SHELL) $(top_srcdir)/cf/install-catman.sh install "$(INSTALL_DATA)" "$(mkinstalldirs)" "$(srcdir)" "$(DESTDIR)$(mandir)" '$(CATMANEXT)' $(man_MANS) $(man1_MANS) $(man3_MANS) $(man5_MANS) $(man8_MANS)
-
-uninstall-cat-mans:
- $(SHELL) $(top_srcdir)/cf/install-catman.sh uninstall "$(INSTALL_DATA)" "$(mkinstalldirs)" "$(srcdir)" "$(DESTDIR)$(mandir)" '$(CATMANEXT)' $(man_MANS) $(man1_MANS) $(man3_MANS) $(man5_MANS) $(man8_MANS)
-
-install-data-hook: install-cat-mans
-uninstall-hook: uninstall-cat-mans
-
-.et.h:
- $(COMPILE_ET) $<
-.et.c:
- $(COMPILE_ET) $<
-
-#
-# Useful target for debugging
-#
-
-check-valgrind:
- tobjdir=`cd $(top_builddir) && pwd` ; \
- tsrcdir=`cd $(top_srcdir) && pwd` ; \
- env TESTS_ENVIRONMENT="$${tsrcdir}/cf/maybe-valgrind.sh -s $${tsrcdir} -o $${tobjdir}" make check
-
-#
-# Target to please samba build farm, builds distfiles in-tree.
-# Will break when automake changes...
-#
-
-distdir-in-tree: $(DISTFILES) $(INFO_DEPS)
- list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
- if test "$$subdir" != .; then \
- (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) distdir-in-tree) ; \
- fi ; \
- done
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/appl/ftp/ftp/NTMakefile b/appl/ftp/ftp/NTMakefile
deleted file mode 100644
index 8bb7c982e0a4..000000000000
--- a/appl/ftp/ftp/NTMakefile
+++ /dev/null
@@ -1,35 +0,0 @@
-########################################################################
-#
-# Copyright (c) 2009, Secure Endpoints Inc.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# - Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-RELDIR=appl\ftp\ftp
-
-!include ../../../windows/NTMakefile.w32
-
diff --git a/appl/ftp/ftp/cmds.c b/appl/ftp/ftp/cmds.c
deleted file mode 100644
index dbd5d581ee3e..000000000000
--- a/appl/ftp/ftp/cmds.c
+++ /dev/null
@@ -1,2148 +0,0 @@
-/*
- * Copyright (c) 1985, 1989, 1993, 1994
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * FTP User Program -- Command Routines.
- */
-
-#include "ftp_locl.h"
-RCSID("$Id$");
-
-typedef void (*sighand)(int);
-
-jmp_buf jabort;
-char *mname;
-char *home = "/";
-
-/*
- * `Another' gets another argument, and stores the new argc and argv.
- * It reverts to the top level (via main.c's intr()) on EOF/error.
- *
- * Returns false if no new arguments have been added.
- */
-int
-another(int *pargc, char ***pargv, char *prompt)
-{
- int len = strlen(line), ret;
-
- if (len >= sizeof(line) - 3) {
- printf("sorry, arguments too long\n");
- intr(0);
- }
- printf("(%s) ", prompt);
- line[len++] = ' ';
- if (fgets(&line[len], sizeof(line) - len, stdin) == NULL)
- intr(0);
- len += strlen(&line[len]);
- if (len > 0 && line[len - 1] == '\n')
- line[len - 1] = '\0';
- makeargv();
- ret = margc > *pargc;
- *pargc = margc;
- *pargv = margv;
- return (ret);
-}
-
-/*
- * Connect to peer server and
- * auto-login, if possible.
- */
-void
-setpeer(int argc, char **argv)
-{
- char *host;
- u_short port;
- struct servent *sp;
-
- if (connected) {
- printf("Already connected to %s, use close first.\n",
- hostname);
- code = -1;
- return;
- }
- if (argc < 2)
- another(&argc, &argv, "to");
- if (argc < 2 || argc > 3) {
- printf("usage: %s host-name [port]\n", argv[0]);
- code = -1;
- return;
- }
- sp = getservbyname("ftp", "tcp");
- if (sp == NULL)
- errx(1, "You bastard. You removed ftp/tcp from services");
- port = sp->s_port;
- if (argc > 2) {
- sp = getservbyname(argv[2], "tcp");
- if (sp != NULL) {
- port = sp->s_port;
- } else {
- char *ep;
-
- port = strtol(argv[2], &ep, 0);
- if (argv[2] == ep) {
- printf("%s: bad port number-- %s\n",
- argv[1], argv[2]);
- printf ("usage: %s host-name [port]\n",
- argv[0]);
- code = -1;
- return;
- }
- port = htons(port);
- }
- }
- host = hookup(argv[1], port);
- if (host) {
- int overbose;
-
- connected = 1;
- /*
- * Set up defaults for FTP.
- */
- strlcpy(typename, "ascii", sizeof(typename));
- type = TYPE_A;
- curtype = TYPE_A;
- strlcpy(formname, "non-print", sizeof(formname));
- form = FORM_N;
- strlcpy(modename, "stream", sizeof(modename));
- mode = MODE_S;
- strlcpy(structname, "file", sizeof(structname));
- stru = STRU_F;
- strlcpy(bytename, "8", sizeof(bytename));
- bytesize = 8;
- if (autologin)
- login(argv[1]);
-
-#if (defined(unix) || defined(__unix__) || defined(__unix) || defined(_AIX) || defined(_CRAY) || defined(__NetBSD__) || defined(__APPLE__)) && NBBY == 8
-/*
- * this ifdef is to keep someone form "porting" this to an incompatible
- * system and not checking this out. This way they have to think about it.
- */
- overbose = verbose;
- if (debug == 0)
- verbose = -1;
- if (command("SYST") == COMPLETE && overbose && strlen(reply_string) > 4) {
- char *cp, *p;
-
- cp = strdup(reply_string + 4);
- if (cp == NULL)
- errx(1, "strdup: out of memory");
- p = strchr(cp, ' ');
- if (p == NULL)
- p = strchr(cp, '\r');
- if (p) {
- if (p[-1] == '.')
- p--;
- *p = '\0';
- }
-
- printf("Remote system type is %s.\n", cp);
- free(cp);
- }
- if (!strncmp(reply_string, "215 UNIX Type: L8", 17)) {
- if (proxy)
- unix_proxy = 1;
- else
- unix_server = 1;
- /*
- * Set type to 0 (not specified by user),
- * meaning binary by default, but don't bother
- * telling server. We can use binary
- * for text files unless changed by the user.
- */
- type = 0;
- strlcpy(typename, "binary", sizeof(typename));
- if (overbose)
- printf("Using %s mode to transfer files.\n",
- typename);
- } else {
- if (proxy)
- unix_proxy = 0;
- else
- unix_server = 0;
- if (overbose &&
- !strncmp(reply_string, "215 TOPS20", 10))
- printf(
-"Remember to set tenex mode when transfering binary files from this machine.\n");
- }
- verbose = overbose;
-#endif /* unix */
- }
-}
-
-struct types {
- char *t_name;
- char *t_mode;
- int t_type;
- char *t_arg;
-} types[] = {
- { "ascii", "A", TYPE_A, 0 },
- { "binary", "I", TYPE_I, 0 },
- { "image", "I", TYPE_I, 0 },
- { "ebcdic", "E", TYPE_E, 0 },
- { "tenex", "L", TYPE_L, bytename },
- { NULL }
-};
-
-/*
- * Set transfer type.
- */
-void
-settype(int argc, char **argv)
-{
- struct types *p;
- int comret;
-
- if (argc > 2) {
- char *sep;
-
- printf("usage: %s [", argv[0]);
- sep = " ";
- for (p = types; p->t_name; p++) {
- printf("%s%s", sep, p->t_name);
- sep = " | ";
- }
- printf(" ]\n");
- code = -1;
- return;
- }
- if (argc < 2) {
- printf("Using %s mode to transfer files.\n", typename);
- code = 0;
- return;
- }
- for (p = types; p->t_name; p++)
- if (strcmp(argv[1], p->t_name) == 0)
- break;
- if (p->t_name == 0) {
- printf("%s: unknown mode\n", argv[1]);
- code = -1;
- return;
- }
- if ((p->t_arg != NULL) && (*(p->t_arg) != '\0'))
- comret = command ("TYPE %s %s", p->t_mode, p->t_arg);
- else
- comret = command("TYPE %s", p->t_mode);
- if (comret == COMPLETE) {
- strlcpy(typename, p->t_name, sizeof(typename));
- curtype = type = p->t_type;
- }
-}
-
-/*
- * Internal form of settype; changes current type in use with server
- * without changing our notion of the type for data transfers.
- * Used to change to and from ascii for listings.
- */
-void
-changetype(int newtype, int show)
-{
- struct types *p;
- int comret, oldverbose = verbose;
-
- if (newtype == 0)
- newtype = TYPE_I;
- if (newtype == curtype)
- return;
- if (debug == 0 && show == 0)
- verbose = 0;
- for (p = types; p->t_name; p++)
- if (newtype == p->t_type)
- break;
- if (p->t_name == 0) {
- printf("ftp: internal error: unknown type %d\n", newtype);
- return;
- }
- if (newtype == TYPE_L && bytename[0] != '\0')
- comret = command("TYPE %s %s", p->t_mode, bytename);
- else
- comret = command("TYPE %s", p->t_mode);
- if (comret == COMPLETE)
- curtype = newtype;
- verbose = oldverbose;
-}
-
-char *stype[] = {
- "type",
- "",
- 0
-};
-
-/*
- * Set binary transfer type.
- */
-/*VARARGS*/
-void
-setbinary(int argc, char **argv)
-{
-
- stype[1] = "binary";
- settype(2, stype);
-}
-
-/*
- * Set ascii transfer type.
- */
-/*VARARGS*/
-void
-setascii(int argc, char **argv)
-{
-
- stype[1] = "ascii";
- settype(2, stype);
-}
-
-/*
- * Set tenex transfer type.
- */
-/*VARARGS*/
-void
-settenex(int argc, char **argv)
-{
-
- stype[1] = "tenex";
- settype(2, stype);
-}
-
-/*
- * Set file transfer mode.
- */
-/*ARGSUSED*/
-void
-setftmode(int argc, char **argv)
-{
-
- printf("We only support %s mode, sorry.\n", modename);
- code = -1;
-}
-
-/*
- * Set file transfer format.
- */
-/*ARGSUSED*/
-void
-setform(int argc, char **argv)
-{
-
- printf("We only support %s format, sorry.\n", formname);
- code = -1;
-}
-
-/*
- * Set file transfer structure.
- */
-/*ARGSUSED*/
-void
-setstruct(int argc, char **argv)
-{
-
- printf("We only support %s structure, sorry.\n", structname);
- code = -1;
-}
-
-/*
- * Send a single file.
- */
-void
-put(int argc, char **argv)
-{
- char *cmd;
- int loc = 0;
- char *oldargv1, *oldargv2;
-
- if (argc == 2) {
- argc++;
- argv[2] = argv[1];
- loc++;
- }
- if (argc < 2 && !another(&argc, &argv, "local-file"))
- goto usage;
- if (argc < 3 && !another(&argc, &argv, "remote-file")) {
-usage:
- printf("usage: %s local-file remote-file\n", argv[0]);
- code = -1;
- return;
- }
- oldargv1 = argv[1];
- oldargv2 = argv[2];
- if (!globulize(&argv[1])) {
- code = -1;
- return;
- }
- /*
- * If "globulize" modifies argv[1], and argv[2] is a copy of
- * the old argv[1], make it a copy of the new argv[1].
- */
- if (argv[1] != oldargv1 && argv[2] == oldargv1) {
- argv[2] = argv[1];
- }
- cmd = (argv[0][0] == 'a') ? "APPE" : ((sunique) ? "STOU" : "STOR");
- if (loc && ntflag) {
- argv[2] = dotrans(argv[2]);
- }
- if (loc && mapflag) {
- argv[2] = domap(argv[2]);
- }
- sendrequest(cmd, argv[1], argv[2],
- curtype == TYPE_I ? "rb" : "r",
- argv[1] != oldargv1 || argv[2] != oldargv2);
-}
-
-/* ARGSUSED */
-static RETSIGTYPE
-mabort(int signo)
-{
- int ointer;
-
- printf("\n");
- fflush(stdout);
- if (mflag && fromatty) {
- ointer = interactive;
- interactive = 1;
- if (confirm("Continue with", mname)) {
- interactive = ointer;
- longjmp(jabort,0);
- }
- interactive = ointer;
- }
- mflag = 0;
- longjmp(jabort,0);
-}
-
-/*
- * Send multiple files.
- */
-void
-mput(int argc, char **argv)
-{
- int i;
- RETSIGTYPE (*oldintr)(int);
- int ointer;
- char *tp;
-
- if (argc < 2 && !another(&argc, &argv, "local-files")) {
- printf("usage: %s local-files\n", argv[0]);
- code = -1;
- return;
- }
- mname = argv[0];
- mflag = 1;
- oldintr = signal(SIGINT, mabort);
- setjmp(jabort);
- if (proxy) {
- char *cp, *tp2, tmpbuf[MaxPathLen];
-
- while ((cp = remglob(argv,0)) != NULL) {
- if (*cp == 0) {
- mflag = 0;
- continue;
- }
- if (mflag && confirm(argv[0], cp)) {
- tp = cp;
- if (mcase) {
- while (*tp && !islower((unsigned char)*tp)) {
- tp++;
- }
- if (!*tp) {
- tp = cp;
- tp2 = tmpbuf;
- while ((*tp2 = *tp) != '\0') {
- if (isupper((unsigned char)*tp2)) {
- *tp2 = 'a' + *tp2 - 'A';
- }
- tp++;
- tp2++;
- }
- }
- tp = tmpbuf;
- }
- if (ntflag) {
- tp = dotrans(tp);
- }
- if (mapflag) {
- tp = domap(tp);
- }
- sendrequest((sunique) ? "STOU" : "STOR",
- cp, tp,
- curtype == TYPE_I ? "rb" : "r",
- cp != tp || !interactive);
- if (!mflag && fromatty) {
- ointer = interactive;
- interactive = 1;
- if (confirm("Continue with","mput")) {
- mflag++;
- }
- interactive = ointer;
- }
- }
- }
- signal(SIGINT, oldintr);
- mflag = 0;
- return;
- }
- for (i = 1; i < argc; i++) {
- char **cpp;
- glob_t gl;
- int flags;
-
- if (!doglob) {
- if (mflag && confirm(argv[0], argv[i])) {
- tp = (ntflag) ? dotrans(argv[i]) : argv[i];
- tp = (mapflag) ? domap(tp) : tp;
- sendrequest((sunique) ? "STOU" : "STOR",
- argv[i],
- curtype == TYPE_I ? "rb" : "r",
- tp, tp != argv[i] || !interactive);
- if (!mflag && fromatty) {
- ointer = interactive;
- interactive = 1;
- if (confirm("Continue with","mput")) {
- mflag++;
- }
- interactive = ointer;
- }
- }
- continue;
- }
-
- memset(&gl, 0, sizeof(gl));
- flags = GLOB_BRACE|GLOB_NOCHECK|GLOB_QUOTE|GLOB_TILDE;
- if (glob(argv[i], flags, NULL, &gl) || gl.gl_pathc == 0) {
- warnx("%s: not found", argv[i]);
- globfree(&gl);
- continue;
- }
- for (cpp = gl.gl_pathv; cpp && *cpp != NULL; cpp++) {
- if (mflag && confirm(argv[0], *cpp)) {
- tp = (ntflag) ? dotrans(*cpp) : *cpp;
- tp = (mapflag) ? domap(tp) : tp;
- sendrequest((sunique) ? "STOU" : "STOR",
- *cpp, tp,
- curtype == TYPE_I ? "rb" : "r",
- *cpp != tp || !interactive);
- if (!mflag && fromatty) {
- ointer = interactive;
- interactive = 1;
- if (confirm("Continue with","mput")) {
- mflag++;
- }
- interactive = ointer;
- }
- }
- }
- globfree(&gl);
- }
- signal(SIGINT, oldintr);
- mflag = 0;
-}
-
-void
-reget(int argc, char **argv)
-{
- getit(argc, argv, 1, curtype == TYPE_I ? "r+wb" : "r+w");
-}
-
-void
-get(int argc, char **argv)
-{
- char *filemode;
-
- if (restart_point) {
- if (curtype == TYPE_I)
- filemode = "r+wb";
- else
- filemode = "r+w";
- } else {
- if (curtype == TYPE_I)
- filemode = "wb";
- else
- filemode = "w";
- }
-
- getit(argc, argv, 0, filemode);
-}
-
-/*
- * Receive one file.
- */
-int
-getit(int argc, char **argv, int restartit, char *filemode)
-{
- int loc = 0;
- int local_given = 1;
- char *oldargv1, *oldargv2;
-
- if (argc == 2) {
- argc++;
- local_given = 0;
- argv[2] = argv[1];
- loc++;
- }
- if ((argc < 2 && !another(&argc, &argv, "remote-file")) ||
- (argc < 3 && !another(&argc, &argv, "local-file"))) {
- printf("usage: %s remote-file [ local-file ]\n", argv[0]);
- code = -1;
- return (0);
- }
- oldargv1 = argv[1];
- oldargv2 = argv[2];
- if (!globulize(&argv[2])) {
- code = -1;
- return (0);
- }
- if (loc && mcase) {
- char *tp = argv[1], *tp2, tmpbuf[MaxPathLen];
-
- while (*tp && !islower((unsigned char)*tp)) {
- tp++;
- }
- if (!*tp) {
- tp = argv[2];
- tp2 = tmpbuf;
- while ((*tp2 = *tp) != '\0') {
- if (isupper((unsigned char)*tp2)) {
- *tp2 = 'a' + *tp2 - 'A';
- }
- tp++;
- tp2++;
- }
- argv[2] = tmpbuf;
- }
- }
- if (loc && ntflag)
- argv[2] = dotrans(argv[2]);
- if (loc && mapflag)
- argv[2] = domap(argv[2]);
- if (restartit) {
- struct stat stbuf;
- int ret;
-
- ret = stat(argv[2], &stbuf);
- if (restartit == 1) {
- if (ret < 0) {
- warn("local: %s", argv[2]);
- return (0);
- }
- restart_point = stbuf.st_size;
- } else if (ret == 0) {
- int overbose;
- int cmdret;
- int yy, mo, day, hour, min, sec;
- struct tm *tm;
- time_t mtime = stbuf.st_mtime;
-
- overbose = verbose;
- if (debug == 0)
- verbose = -1;
- cmdret = command("MDTM %s", argv[1]);
- verbose = overbose;
- if (cmdret != COMPLETE) {
- printf("%s\n", reply_string);
- return (0);
- }
- if (sscanf(reply_string,
- "%*s %04d%02d%02d%02d%02d%02d",
- &yy, &mo, &day, &hour, &min, &sec)
- != 6) {
- printf ("bad MDTM result\n");
- return (0);
- }
-
- tm = gmtime(&mtime);
- tm->tm_mon++;
- tm->tm_year += 1900;
-
- if ((tm->tm_year > yy) ||
- (tm->tm_year == yy &&
- tm->tm_mon > mo) ||
- (tm->tm_mon == mo &&
- tm->tm_mday > day) ||
- (tm->tm_mday == day &&
- tm->tm_hour > hour) ||
- (tm->tm_hour == hour &&
- tm->tm_min > min) ||
- (tm->tm_min == min &&
- tm->tm_sec > sec))
- return (1);
- }
- }
-
- recvrequest("RETR", argv[2], argv[1], filemode,
- argv[1] != oldargv1 || argv[2] != oldargv2, local_given);
- restart_point = 0;
- return (0);
-}
-
-static int
-suspicious_filename(const char *fn)
-{
- return strstr(fn, "../") != NULL || *fn == '/';
-}
-
-/*
- * Get multiple files.
- */
-void
-mget(int argc, char **argv)
-{
- sighand oldintr;
- int ch, ointer;
- char *cp, *tp, *tp2, tmpbuf[MaxPathLen];
-
- if (argc < 2 && !another(&argc, &argv, "remote-files")) {
- printf("usage: %s remote-files\n", argv[0]);
- code = -1;
- return;
- }
- mname = argv[0];
- mflag = 1;
- oldintr = signal(SIGINT, mabort);
- setjmp(jabort);
- while ((cp = remglob(argv,proxy)) != NULL) {
- if (*cp == '\0') {
- mflag = 0;
- continue;
- }
- if (mflag && suspicious_filename(cp))
- printf("*** Suspicious filename: %s\n", cp);
- if (mflag && confirm(argv[0], cp)) {
- tp = cp;
- if (mcase) {
- for (tp2 = tmpbuf;(ch = (unsigned char)*tp++);)
- *tp2++ = tolower(ch);
- *tp2 = '\0';
- tp = tmpbuf;
- }
- if (ntflag) {
- tp = dotrans(tp);
- }
- if (mapflag) {
- tp = domap(tp);
- }
- recvrequest("RETR", tp, cp,
- curtype == TYPE_I ? "wb" : "w",
- tp != cp || !interactive, 0);
- if (!mflag && fromatty) {
- ointer = interactive;
- interactive = 1;
- if (confirm("Continue with","mget")) {
- mflag++;
- }
- interactive = ointer;
- }
- }
- }
- signal(SIGINT,oldintr);
- mflag = 0;
-}
-
-char *
-remglob(char **argv, int doswitch)
-{
- char temp[16];
- static char buf[MaxPathLen];
- static FILE *ftemp = NULL;
- static char **args;
- int oldverbose, oldhash;
- char *cp, *filemode;
-
- if (!mflag) {
- if (!doglob) {
- args = NULL;
- }
- else {
- if (ftemp) {
- fclose(ftemp);
- ftemp = NULL;
- }
- }
- return (NULL);
- }
- if (!doglob) {
- if (args == NULL)
- args = argv;
- if ((cp = *++args) == NULL)
- args = NULL;
- return (cp);
- }
- if (ftemp == NULL) {
- int fd;
- strlcpy(temp, _PATH_TMP_XXX, sizeof(temp));
- fd = mkstemp(temp);
- if(fd < 0){
- warn("unable to create temporary file %s", temp);
- return NULL;
- }
- close(fd);
- oldverbose = verbose, verbose = 0;
- oldhash = hash, hash = 0;
- if (doswitch) {
- pswitch(!proxy);
- }
- for (filemode = "w"; *++argv != NULL; filemode = "a")
- recvrequest ("NLST", temp, *argv, filemode, 0, 0);
- if (doswitch) {
- pswitch(!proxy);
- }
- verbose = oldverbose; hash = oldhash;
- ftemp = fopen(temp, "r");
- unlink(temp);
- if (ftemp == NULL) {
- printf("can't find list of remote files, oops\n");
- return (NULL);
- }
- }
- while(fgets(buf, sizeof (buf), ftemp)) {
- if ((cp = strchr(buf, '\n')) != NULL)
- *cp = '\0';
- if(!interactive && suspicious_filename(buf)){
- printf("Ignoring remote globbed file `%s'\n", buf);
- continue;
- }
- return buf;
- }
- fclose(ftemp);
- ftemp = NULL;
- return (NULL);
-}
-
-char *
-onoff(int bool)
-{
-
- return (bool ? "on" : "off");
-}
-
-/*
- * Show status.
- */
-/*ARGSUSED*/
-void
-status(int argc, char **argv)
-{
- int i;
-
- if (connected)
- printf("Connected to %s.\n", hostname);
- else
- printf("Not connected.\n");
- if (!proxy) {
- pswitch(1);
- if (connected) {
- printf("Connected for proxy commands to %s.\n", hostname);
- }
- else {
- printf("No proxy connection.\n");
- }
- pswitch(0);
- }
- sec_status();
- printf("Mode: %s; Type: %s; Form: %s; Structure: %s\n",
- modename, typename, formname, structname);
- printf("Verbose: %s; Bell: %s; Prompting: %s; Globbing: %s\n",
- onoff(verbose), onoff(bell), onoff(interactive),
- onoff(doglob));
- printf("Store unique: %s; Receive unique: %s\n", onoff(sunique),
- onoff(runique));
- printf("Case: %s; CR stripping: %s\n",onoff(mcase),onoff(crflag));
- if (ntflag) {
- printf("Ntrans: (in) %s (out) %s\n", ntin,ntout);
- }
- else {
- printf("Ntrans: off\n");
- }
- if (mapflag) {
- printf("Nmap: (in) %s (out) %s\n", mapin, mapout);
- }
- else {
- printf("Nmap: off\n");
- }
- printf("Hash mark printing: %s; Use of PORT cmds: %s\n",
- onoff(hash), onoff(sendport));
- if (macnum > 0) {
- printf("Macros:\n");
- for (i=0; i<macnum; i++) {
- printf("\t%s\n",macros[i].mac_name);
- }
- }
- code = 0;
-}
-
-/*
- * Set beep on cmd completed mode.
- */
-/*VARARGS*/
-void
-setbell(int argc, char **argv)
-{
-
- bell = !bell;
- printf("Bell mode %s.\n", onoff(bell));
- code = bell;
-}
-
-/*
- * Turn on packet tracing.
- */
-/*VARARGS*/
-void
-settrace(int argc, char **argv)
-{
-
- trace = !trace;
- printf("Packet tracing %s.\n", onoff(trace));
- code = trace;
-}
-
-/*
- * Toggle hash mark printing during transfers.
- */
-/*VARARGS*/
-void
-sethash(int argc, char **argv)
-{
-
- hash = !hash;
- printf("Hash mark printing %s", onoff(hash));
- code = hash;
- if (hash)
- printf(" (%d bytes/hash mark)", 1024);
- printf(".\n");
-}
-
-/*
- * Turn on printing of server echo's.
- */
-/*VARARGS*/
-void
-setverbose(int argc, char **argv)
-{
-
- verbose = !verbose;
- printf("Verbose mode %s.\n", onoff(verbose));
- code = verbose;
-}
-
-/*
- * Toggle PORT cmd use before each data connection.
- */
-/*VARARGS*/
-void
-setport(int argc, char **argv)
-{
-
- sendport = !sendport;
- printf("Use of PORT cmds %s.\n", onoff(sendport));
- code = sendport;
-}
-
-/*
- * Turn on interactive prompting
- * during mget, mput, and mdelete.
- */
-/*VARARGS*/
-void
-setprompt(int argc, char **argv)
-{
-
- interactive = !interactive;
- printf("Interactive mode %s.\n", onoff(interactive));
- code = interactive;
-}
-
-/*
- * Toggle metacharacter interpretation
- * on local file names.
- */
-/*VARARGS*/
-void
-setglob(int argc, char **argv)
-{
-
- doglob = !doglob;
- printf("Globbing %s.\n", onoff(doglob));
- code = doglob;
-}
-
-/*
- * Set debugging mode on/off and/or
- * set level of debugging.
- */
-/*VARARGS*/
-void
-setdebug(int argc, char **argv)
-{
- int val;
-
- if (argc > 1) {
- val = atoi(argv[1]);
- if (val < 0) {
- printf("%s: bad debugging value.\n", argv[1]);
- code = -1;
- return;
- }
- } else
- val = !debug;
- debug = val;
- if (debug)
- options |= SO_DEBUG;
- else
- options &= ~SO_DEBUG;
- printf("Debugging %s (debug=%d).\n", onoff(debug), debug);
- code = debug > 0;
-}
-
-/*
- * Set current working directory
- * on remote machine.
- */
-void
-cd(int argc, char **argv)
-{
-
- if (argc < 2 && !another(&argc, &argv, "remote-directory")) {
- printf("usage: %s remote-directory\n", argv[0]);
- code = -1;
- return;
- }
- if (command("CWD %s", argv[1]) == ERROR && code == 500) {
- if (verbose)
- printf("CWD command not recognized, trying XCWD\n");
- command("XCWD %s", argv[1]);
- }
-}
-
-/*
- * Set current working directory
- * on local machine.
- */
-void
-lcd(int argc, char **argv)
-{
- char buf[MaxPathLen];
-
- if (argc < 2)
- argc++, argv[1] = home;
- if (argc != 2) {
- printf("usage: %s local-directory\n", argv[0]);
- code = -1;
- return;
- }
- if (!globulize(&argv[1])) {
- code = -1;
- return;
- }
- if (chdir(argv[1]) < 0) {
- warn("local: %s", argv[1]);
- code = -1;
- return;
- }
- if (getcwd(buf, sizeof(buf)) != NULL)
- printf("Local directory now %s\n", buf);
- else
- warnx("getwd: %s", buf);
- code = 0;
-}
-
-/*
- * Delete a single file.
- */
-void
-delete(int argc, char **argv)
-{
-
- if (argc < 2 && !another(&argc, &argv, "remote-file")) {
- printf("usage: %s remote-file\n", argv[0]);
- code = -1;
- return;
- }
- command("DELE %s", argv[1]);
-}
-
-/*
- * Delete multiple files.
- */
-void
-mdelete(int argc, char **argv)
-{
- sighand oldintr;
- int ointer;
- char *cp;
-
- if (argc < 2 && !another(&argc, &argv, "remote-files")) {
- printf("usage: %s remote-files\n", argv[0]);
- code = -1;
- return;
- }
- mname = argv[0];
- mflag = 1;
- oldintr = signal(SIGINT, mabort);
- setjmp(jabort);
- while ((cp = remglob(argv,0)) != NULL) {
- if (*cp == '\0') {
- mflag = 0;
- continue;
- }
- if (mflag && confirm(argv[0], cp)) {
- command("DELE %s", cp);
- if (!mflag && fromatty) {
- ointer = interactive;
- interactive = 1;
- if (confirm("Continue with", "mdelete")) {
- mflag++;
- }
- interactive = ointer;
- }
- }
- }
- signal(SIGINT, oldintr);
- mflag = 0;
-}
-
-/*
- * Rename a remote file.
- */
-void
-renamefile(int argc, char **argv)
-{
-
- if (argc < 2 && !another(&argc, &argv, "from-name"))
- goto usage;
- if (argc < 3 && !another(&argc, &argv, "to-name")) {
-usage:
- printf("%s from-name to-name\n", argv[0]);
- code = -1;
- return;
- }
- if (command("RNFR %s", argv[1]) == CONTINUE)
- command("RNTO %s", argv[2]);
-}
-
-/*
- * Get a directory listing
- * of remote files.
- */
-void
-ls(int argc, char **argv)
-{
- char *cmd;
-
- if (argc < 2)
- argc++, argv[1] = NULL;
- if (argc < 3)
- argc++, argv[2] = "-";
- if (argc > 3) {
- printf("usage: %s remote-directory local-file\n", argv[0]);
- code = -1;
- return;
- }
- cmd = argv[0][0] == 'n' ? "NLST" : "LIST";
- if (strcmp(argv[2], "-") && !globulize(&argv[2])) {
- code = -1;
- return;
- }
- if (strcmp(argv[2], "-") && *argv[2] != '|')
- if (!globulize(&argv[2]) || !confirm("output to local-file:",
- argv[2])) {
- code = -1;
- return;
- }
- recvrequest(cmd, argv[2], argv[1], "w", 0, 1);
-}
-
-/*
- * Get a directory listing
- * of multiple remote files.
- */
-void
-mls(int argc, char **argv)
-{
- sighand oldintr;
- int ointer, i;
- char *cmd, filemode[2], *dest;
-
- if (argc < 2 && !another(&argc, &argv, "remote-files"))
- goto usage;
- if (argc < 3 && !another(&argc, &argv, "local-file")) {
-usage:
- printf("usage: %s remote-files local-file\n", argv[0]);
- code = -1;
- return;
- }
- dest = argv[argc - 1];
- argv[argc - 1] = NULL;
- if (strcmp(dest, "-") && *dest != '|')
- if (!globulize(&dest) ||
- !confirm("output to local-file:", dest)) {
- code = -1;
- return;
- }
- cmd = argv[0][1] == 'l' ? "NLST" : "LIST";
- mname = argv[0];
- mflag = 1;
- oldintr = signal(SIGINT, mabort);
- setjmp(jabort);
- filemode[1] = '\0';
- for (i = 1; mflag && i < argc-1; ++i) {
- *filemode = (i == 1) ? 'w' : 'a';
- recvrequest(cmd, dest, argv[i], filemode, 0, 1);
- if (!mflag && fromatty) {
- ointer = interactive;
- interactive = 1;
- if (confirm("Continue with", argv[0])) {
- mflag ++;
- }
- interactive = ointer;
- }
- }
- signal(SIGINT, oldintr);
- mflag = 0;
-}
-
-/*
- * Do a shell escape
- */
-/*ARGSUSED*/
-void
-shell(int argc, char **argv)
-{
- pid_t pid;
- RETSIGTYPE (*old1)(int), (*old2)(int);
- char shellnam[40], *shellpath, *namep;
- int waitstatus;
-
- old1 = signal (SIGINT, SIG_IGN);
- old2 = signal (SIGQUIT, SIG_IGN);
- if ((pid = fork()) == 0) {
- for (pid = 3; pid < 20; pid++)
- close(pid);
- signal(SIGINT, SIG_DFL);
- signal(SIGQUIT, SIG_DFL);
- shellpath = getenv("SHELL");
- if (shellpath == NULL)
- shellpath = _PATH_BSHELL;
- namep = strrchr(shellpath, '/');
- if (namep == NULL)
- namep = shellpath;
- snprintf (shellnam, sizeof(shellnam),
- "-%s", ++namep);
- if (strcmp(namep, "sh") != 0)
- shellnam[0] = '+';
- if (debug) {
- printf ("%s\n", shellpath);
- fflush (stdout);
- }
- if (argc > 1) {
- execl(shellpath,shellnam,"-c",altarg,(char *)0);
- }
- else {
- execl(shellpath,shellnam,(char *)0);
- }
- warn("%s", shellpath);
- code = -1;
- exit(1);
- }
- if (pid > 0)
- while (waitpid(-1, &waitstatus, 0) != pid)
- ;
- signal(SIGINT, old1);
- signal(SIGQUIT, old2);
- if (pid == -1) {
- warn("%s", "Try again later");
- code = -1;
- }
- else {
- code = 0;
- }
-}
-
-/*
- * Send new user information (re-login)
- */
-void
-user(int argc, char **argv)
-{
- char acctstr[80];
- int n, aflag = 0;
- char tmp[256];
-
- if (argc < 2)
- another(&argc, &argv, "username");
- if (argc < 2 || argc > 4) {
- printf("usage: %s username [password] [account]\n", argv[0]);
- code = -1;
- return;
- }
- n = command("USER %s", argv[1]);
- if (n == CONTINUE) {
- if (argc < 3 ) {
- UI_UTIL_read_pw_string (tmp,
- sizeof(tmp),
- "Password: ", 0);
- argv[2] = tmp;
- argc++;
- }
- n = command("PASS %s", argv[2]);
- }
- if (n == CONTINUE) {
- if (argc < 4) {
- printf("Account: "); fflush(stdout);
- fgets(acctstr, sizeof(acctstr) - 1, stdin);
- acctstr[strcspn(acctstr, "\r\n")] = '\0';
- argv[3] = acctstr; argc++;
- }
- n = command("ACCT %s", argv[3]);
- aflag++;
- }
- if (n != COMPLETE) {
- fprintf(stdout, "Login failed.\n");
- return;
- }
- if (!aflag && argc == 4) {
- command("ACCT %s", argv[3]);
- }
-}
-
-/*
- * Print working directory.
- */
-/*VARARGS*/
-void
-pwd(int argc, char **argv)
-{
- int oldverbose = verbose;
-
- /*
- * If we aren't verbose, this doesn't do anything!
- */
- verbose = 1;
- if (command("PWD") == ERROR && code == 500) {
- printf("PWD command not recognized, trying XPWD\n");
- command("XPWD");
- }
- verbose = oldverbose;
-}
-
-/*
- * Make a directory.
- */
-void
-makedir(int argc, char **argv)
-{
-
- if (argc < 2 && !another(&argc, &argv, "directory-name")) {
- printf("usage: %s directory-name\n", argv[0]);
- code = -1;
- return;
- }
- if (command("MKD %s", argv[1]) == ERROR && code == 500) {
- if (verbose)
- printf("MKD command not recognized, trying XMKD\n");
- command("XMKD %s", argv[1]);
- }
-}
-
-/*
- * Remove a directory.
- */
-void
-removedir(int argc, char **argv)
-{
-
- if (argc < 2 && !another(&argc, &argv, "directory-name")) {
- printf("usage: %s directory-name\n", argv[0]);
- code = -1;
- return;
- }
- if (command("RMD %s", argv[1]) == ERROR && code == 500) {
- if (verbose)
- printf("RMD command not recognized, trying XRMD\n");
- command("XRMD %s", argv[1]);
- }
-}
-
-/*
- * Send a line, verbatim, to the remote machine.
- */
-void
-quote(int argc, char **argv)
-{
-
- if (argc < 2 && !another(&argc, &argv, "command line to send")) {
- printf("usage: %s line-to-send\n", argv[0]);
- code = -1;
- return;
- }
- quote1("", argc, argv);
-}
-
-/*
- * Send a SITE command to the remote machine. The line
- * is sent verbatim to the remote machine, except that the
- * word "SITE" is added at the front.
- */
-void
-site(int argc, char **argv)
-{
-
- if (argc < 2 && !another(&argc, &argv, "arguments to SITE command")) {
- printf("usage: %s line-to-send\n", argv[0]);
- code = -1;
- return;
- }
- quote1("SITE ", argc, argv);
-}
-
-/*
- * Turn argv[1..argc) into a space-separated string, then prepend initial text.
- * Send the result as a one-line command and get response.
- */
-void
-quote1(char *initial, int argc, char **argv)
-{
- int i;
- char buf[BUFSIZ]; /* must be >= sizeof(line) */
-
- strlcpy(buf, initial, sizeof(buf));
- for(i = 1; i < argc; i++) {
- if(i > 1)
- strlcat(buf, " ", sizeof(buf));
- strlcat(buf, argv[i], sizeof(buf));
- }
- if (command("%s", buf) == PRELIM) {
- while (getreply(0) == PRELIM)
- continue;
- }
-}
-
-void
-do_chmod(int argc, char **argv)
-{
-
- if (argc < 2 && !another(&argc, &argv, "mode"))
- goto usage;
- if (argc < 3 && !another(&argc, &argv, "file-name")) {
-usage:
- printf("usage: %s mode file-name\n", argv[0]);
- code = -1;
- return;
- }
- command("SITE CHMOD %s %s", argv[1], argv[2]);
-}
-
-void
-do_umask(int argc, char **argv)
-{
- int oldverbose = verbose;
-
- verbose = 1;
- command(argc == 1 ? "SITE UMASK" : "SITE UMASK %s", argv[1]);
- verbose = oldverbose;
-}
-
-void
-ftp_idle(int argc, char **argv)
-{
- int oldverbose = verbose;
-
- verbose = 1;
- command(argc == 1 ? "SITE IDLE" : "SITE IDLE %s", argv[1]);
- verbose = oldverbose;
-}
-
-/*
- * Ask the other side for help.
- */
-void
-rmthelp(int argc, char **argv)
-{
- int oldverbose = verbose;
-
- verbose = 1;
- command(argc == 1 ? "HELP" : "HELP %s", argv[1]);
- verbose = oldverbose;
-}
-
-/*
- * Terminate session and exit.
- */
-/*VARARGS*/
-void
-quit(int argc, char **argv)
-{
-
- if (connected)
- disconnect(0, 0);
- pswitch(1);
- if (connected) {
- disconnect(0, 0);
- }
- exit(0);
-}
-
-/*
- * Terminate session, but don't exit.
- */
-void
-disconnect(int argc, char **argv)
-{
-
- if (!connected)
- return;
- command("QUIT");
- if (cout) {
- fclose(cout);
- }
- cout = NULL;
- connected = 0;
- sec_end();
- data = -1;
- if (!proxy) {
- macnum = 0;
- }
-}
-
-int
-confirm(char *cmd, char *file)
-{
- char buf[BUFSIZ];
-
- if (!interactive)
- return (1);
- printf("%s %s? ", cmd, file);
- fflush(stdout);
- if (fgets(buf, sizeof buf, stdin) == NULL)
- return (0);
- return (*buf == 'y' || *buf == 'Y');
-}
-
-void
-fatal(char *msg)
-{
-
- errx(1, "%s", msg);
-}
-
-/*
- * Glob a local file name specification with
- * the expectation of a single return value.
- * Can't control multiple values being expanded
- * from the expression, we return only the first.
- */
-int
-globulize(char **cpp)
-{
- glob_t gl;
- int flags;
-
- if (!doglob)
- return (1);
-
- flags = GLOB_BRACE|GLOB_NOCHECK|GLOB_QUOTE|GLOB_TILDE;
- memset(&gl, 0, sizeof(gl));
- if (glob(*cpp, flags, NULL, &gl) ||
- gl.gl_pathc == 0) {
- warnx("%s: not found", *cpp);
- globfree(&gl);
- return (0);
- }
- *cpp = strdup(gl.gl_pathv[0]); /* XXX - wasted memory */
- globfree(&gl);
- return (1);
-}
-
-void
-account(int argc, char **argv)
-{
- char acctstr[50];
-
- if (argc > 1) {
- ++argv;
- --argc;
- strlcpy (acctstr, *argv, sizeof(acctstr));
- while (argc > 1) {
- --argc;
- ++argv;
- strlcat(acctstr, *argv, sizeof(acctstr));
- }
- }
- else {
- UI_UTIL_read_pw_string(acctstr, sizeof(acctstr), "Account:", 0);
- }
- command("ACCT %s", acctstr);
-}
-
-jmp_buf abortprox;
-
-static RETSIGTYPE
-proxabort(int sig)
-{
-
- if (!proxy) {
- pswitch(1);
- }
- if (connected) {
- proxflag = 1;
- }
- else {
- proxflag = 0;
- }
- pswitch(0);
- longjmp(abortprox,1);
-}
-
-void
-doproxy(int argc, char **argv)
-{
- struct cmd *c;
- RETSIGTYPE (*oldintr)(int);
-
- if (argc < 2 && !another(&argc, &argv, "command")) {
- printf("usage: %s command\n", argv[0]);
- code = -1;
- return;
- }
- c = getcmd(argv[1]);
- if (c == (struct cmd *) -1) {
- printf("?Ambiguous command\n");
- fflush(stdout);
- code = -1;
- return;
- }
- if (c == 0) {
- printf("?Invalid command\n");
- fflush(stdout);
- code = -1;
- return;
- }
- if (!c->c_proxy) {
- printf("?Invalid proxy command\n");
- fflush(stdout);
- code = -1;
- return;
- }
- if (setjmp(abortprox)) {
- code = -1;
- return;
- }
- oldintr = signal(SIGINT, proxabort);
- pswitch(1);
- if (c->c_conn && !connected) {
- printf("Not connected\n");
- fflush(stdout);
- pswitch(0);
- signal(SIGINT, oldintr);
- code = -1;
- return;
- }
- (*c->c_handler)(argc-1, argv+1);
- if (connected) {
- proxflag = 1;
- }
- else {
- proxflag = 0;
- }
- pswitch(0);
- signal(SIGINT, oldintr);
-}
-
-void
-setcase(int argc, char **argv)
-{
-
- mcase = !mcase;
- printf("Case mapping %s.\n", onoff(mcase));
- code = mcase;
-}
-
-void
-setcr(int argc, char **argv)
-{
-
- crflag = !crflag;
- printf("Carriage Return stripping %s.\n", onoff(crflag));
- code = crflag;
-}
-
-void
-setntrans(int argc, char **argv)
-{
- if (argc == 1) {
- ntflag = 0;
- printf("Ntrans off.\n");
- code = ntflag;
- return;
- }
- ntflag++;
- code = ntflag;
- strlcpy (ntin, argv[1], 17);
- if (argc == 2) {
- ntout[0] = '\0';
- return;
- }
- strlcpy (ntout, argv[2], 17);
-}
-
-char *
-dotrans(char *name)
-{
- static char new[MaxPathLen];
- char *cp1, *cp2 = new;
- int i, ostop, found;
-
- for (ostop = 0; *(ntout + ostop) && ostop < 16; ostop++)
- continue;
- for (cp1 = name; *cp1; cp1++) {
- found = 0;
- for (i = 0; *(ntin + i) && i < 16; i++) {
- if (*cp1 == *(ntin + i)) {
- found++;
- if (i < ostop) {
- *cp2++ = *(ntout + i);
- }
- break;
- }
- }
- if (!found) {
- *cp2++ = *cp1;
- }
- }
- *cp2 = '\0';
- return (new);
-}
-
-void
-setnmap(int argc, char **argv)
-{
- char *cp;
-
- if (argc == 1) {
- mapflag = 0;
- printf("Nmap off.\n");
- code = mapflag;
- return;
- }
- if (argc < 3 && !another(&argc, &argv, "mapout")) {
- printf("Usage: %s [mapin mapout]\n",argv[0]);
- code = -1;
- return;
- }
- mapflag = 1;
- code = 1;
- cp = strchr(altarg, ' ');
- if (cp == NULL) {
- printf("Usage: %s missing space\n",argv[0]);
- code = -1;
- return;
- }
- if (proxy) {
- while(*++cp == ' ')
- continue;
- altarg = cp;
- cp = strchr(altarg, ' ');
- }
- *cp = '\0';
- strlcpy(mapin, altarg, MaxPathLen);
- while (*++cp == ' ')
- continue;
- strlcpy(mapout, cp, MaxPathLen);
-}
-
-char *
-domap(char *name)
-{
- static char new[MaxPathLen];
- char *cp1 = name, *cp2 = mapin;
- char *tp[9], *te[9];
- int i, toks[9], toknum = 0, match = 1;
-
- for (i=0; i < 9; ++i) {
- toks[i] = 0;
- }
- while (match && *cp1 && *cp2) {
- switch (*cp2) {
- case '\\':
- if (*++cp2 != *cp1) {
- match = 0;
- }
- break;
- case '$':
- if (*(cp2+1) >= '1' && (*cp2+1) <= '9') {
- if (*cp1 != *(++cp2+1)) {
- toks[toknum = *cp2 - '1']++;
- tp[toknum] = cp1;
- while (*++cp1 && *(cp2+1)
- != *cp1);
- te[toknum] = cp1;
- }
- cp2++;
- break;
- }
- /* FALLTHROUGH */
- default:
- if (*cp2 != *cp1) {
- match = 0;
- }
- break;
- }
- if (match && *cp1) {
- cp1++;
- }
- if (match && *cp2) {
- cp2++;
- }
- }
- if (!match && *cp1) /* last token mismatch */
- {
- toks[toknum] = 0;
- }
- cp1 = new;
- *cp1 = '\0';
- cp2 = mapout;
- while (*cp2) {
- match = 0;
- switch (*cp2) {
- case '\\':
- if (*(cp2 + 1)) {
- *cp1++ = *++cp2;
- }
- break;
- case '[':
-LOOP:
- if (*++cp2 == '$' && isdigit((unsigned char)*(cp2+1))) {
- if (*++cp2 == '0') {
- char *cp3 = name;
-
- while (*cp3) {
- *cp1++ = *cp3++;
- }
- match = 1;
- }
- else if (toks[toknum = *cp2 - '1']) {
- char *cp3 = tp[toknum];
-
- while (cp3 != te[toknum]) {
- *cp1++ = *cp3++;
- }
- match = 1;
- }
- }
- else {
- while (*cp2 && *cp2 != ',' &&
- *cp2 != ']') {
- if (*cp2 == '\\') {
- cp2++;
- }
- else if (*cp2 == '$' &&
- isdigit((unsigned char)*(cp2+1))) {
- if (*++cp2 == '0') {
- char *cp3 = name;
-
- while (*cp3) {
- *cp1++ = *cp3++;
- }
- }
- else if (toks[toknum =
- *cp2 - '1']) {
- char *cp3=tp[toknum];
-
- while (cp3 !=
- te[toknum]) {
- *cp1++ = *cp3++;
- }
- }
- }
- else if (*cp2) {
- *cp1++ = *cp2++;
- }
- }
- if (!*cp2) {
- printf("nmap: unbalanced brackets\n");
- return (name);
- }
- match = 1;
- cp2--;
- }
- if (match) {
- while (*++cp2 && *cp2 != ']') {
- if (*cp2 == '\\' && *(cp2 + 1)) {
- cp2++;
- }
- }
- if (!*cp2) {
- printf("nmap: unbalanced brackets\n");
- return (name);
- }
- break;
- }
- switch (*++cp2) {
- case ',':
- goto LOOP;
- case ']':
- break;
- default:
- cp2--;
- goto LOOP;
- }
- break;
- case '$':
- if (isdigit((unsigned char)*(cp2 + 1))) {
- if (*++cp2 == '0') {
- char *cp3 = name;
-
- while (*cp3) {
- *cp1++ = *cp3++;
- }
- }
- else if (toks[toknum = *cp2 - '1']) {
- char *cp3 = tp[toknum];
-
- while (cp3 != te[toknum]) {
- *cp1++ = *cp3++;
- }
- }
- break;
- }
- /* intentional drop through */
- default:
- *cp1++ = *cp2;
- break;
- }
- cp2++;
- }
- *cp1 = '\0';
- if (!*new) {
- return (name);
- }
- return (new);
-}
-
-void
-setpassive(int argc, char **argv)
-{
-
- passivemode = !passivemode;
- printf("Passive mode %s.\n", onoff(passivemode));
- code = passivemode;
-}
-
-void
-setsunique(int argc, char **argv)
-{
-
- sunique = !sunique;
- printf("Store unique %s.\n", onoff(sunique));
- code = sunique;
-}
-
-void
-setrunique(int argc, char **argv)
-{
-
- runique = !runique;
- printf("Receive unique %s.\n", onoff(runique));
- code = runique;
-}
-
-/* change directory to perent directory */
-void
-cdup(int argc, char **argv)
-{
-
- if (command("CDUP") == ERROR && code == 500) {
- if (verbose)
- printf("CDUP command not recognized, trying XCUP\n");
- command("XCUP");
- }
-}
-
-/* restart transfer at specific point */
-void
-restart(int argc, char **argv)
-{
-
- if (argc != 2)
- printf("restart: offset not specified\n");
- else {
- restart_point = atol(argv[1]);
- printf("restarting at %ld. %s\n", (long)restart_point,
- "execute get, put or append to initiate transfer");
- }
-}
-
-/* show remote system type */
-void
-syst(int argc, char **argv)
-{
-
- command("SYST");
-}
-
-void
-macdef(int argc, char **argv)
-{
- char *tmp;
- int c;
-
- if (macnum == 16) {
- printf("Limit of 16 macros have already been defined\n");
- code = -1;
- return;
- }
- if (argc < 2 && !another(&argc, &argv, "macro name")) {
- printf("Usage: %s macro_name\n",argv[0]);
- code = -1;
- return;
- }
- if (interactive) {
- printf("Enter macro line by line, terminating it with a null line\n");
- }
- strlcpy(macros[macnum].mac_name,
- argv[1],
- sizeof(macros[macnum].mac_name));
- if (macnum == 0) {
- macros[macnum].mac_start = macbuf;
- }
- else {
- macros[macnum].mac_start = macros[macnum - 1].mac_end + 1;
- }
- tmp = macros[macnum].mac_start;
- while (tmp != macbuf+4096) {
- if ((c = getchar()) == EOF) {
- printf("macdef:end of file encountered\n");
- code = -1;
- return;
- }
- if ((*tmp = c) == '\n') {
- if (tmp == macros[macnum].mac_start) {
- macros[macnum++].mac_end = tmp;
- code = 0;
- return;
- }
- if (*(tmp-1) == '\0') {
- macros[macnum++].mac_end = tmp - 1;
- code = 0;
- return;
- }
- *tmp = '\0';
- }
- tmp++;
- }
- while (1) {
- while ((c = getchar()) != '\n' && c != EOF)
- /* LOOP */;
- if (c == EOF || getchar() == '\n') {
- printf("Macro not defined - 4k buffer exceeded\n");
- code = -1;
- return;
- }
- }
-}
-
-/*
- * get size of file on remote machine
- */
-void
-sizecmd(int argc, char **argv)
-{
-
- if (argc < 2 && !another(&argc, &argv, "filename")) {
- printf("usage: %s filename\n", argv[0]);
- code = -1;
- return;
- }
- command("SIZE %s", argv[1]);
-}
-
-/*
- * get last modification time of file on remote machine
- */
-void
-modtime(int argc, char **argv)
-{
- int overbose;
-
- if (argc < 2 && !another(&argc, &argv, "filename")) {
- printf("usage: %s filename\n", argv[0]);
- code = -1;
- return;
- }
- overbose = verbose;
- if (debug == 0)
- verbose = -1;
- if (command("MDTM %s", argv[1]) == COMPLETE) {
- int yy, mo, day, hour, min, sec;
- sscanf(reply_string, "%*s %04d%02d%02d%02d%02d%02d", &yy, &mo,
- &day, &hour, &min, &sec);
- /* might want to print this in local time */
- printf("%s\t%02d/%02d/%04d %02d:%02d:%02d GMT\n", argv[1],
- mo, day, yy, hour, min, sec);
- } else
- printf("%s\n", reply_string);
- verbose = overbose;
-}
-
-/*
- * show status on reomte machine
- */
-void
-rmtstatus(int argc, char **argv)
-{
-
- command(argc > 1 ? "STAT %s" : "STAT" , argv[1]);
-}
-
-/*
- * get file if modtime is more recent than current file
- */
-void
-newer(int argc, char **argv)
-{
-
- if (getit(argc, argv, -1, curtype == TYPE_I ? "wb" : "w"))
- printf("Local file \"%s\" is newer than remote file \"%s\"\n",
- argv[2], argv[1]);
-}
-
-void
-klist(int argc, char **argv)
-{
- int ret;
- if(argc != 1){
- printf("usage: %s\n", argv[0]);
- code = -1;
- return;
- }
-
- ret = command("SITE KLIST");
- code = (ret == COMPLETE);
-}
diff --git a/appl/ftp/ftp/cmdtab.c b/appl/ftp/ftp/cmdtab.c
deleted file mode 100644
index 7b4c32942536..000000000000
--- a/appl/ftp/ftp/cmdtab.c
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Copyright (c) 1985, 1989, 1993, 1994
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "ftp_locl.h"
-
-/*
- * User FTP -- Command Tables.
- */
-
-char accounthelp[] = "send account command to remote server";
-char appendhelp[] = "append to a file";
-char asciihelp[] = "set ascii transfer type";
-char beephelp[] = "beep when command completed";
-char binaryhelp[] = "set binary transfer type";
-char casehelp[] = "toggle mget upper/lower case id mapping";
-char cdhelp[] = "change remote working directory";
-char cduphelp[] = "change remote working directory to parent directory";
-char chmodhelp[] = "change file permissions of remote file";
-char connecthelp[] = "connect to remote tftp";
-char crhelp[] = "toggle carriage return stripping on ascii gets";
-char deletehelp[] = "delete remote file";
-char debughelp[] = "toggle/set debugging mode";
-char dirhelp[] = "list contents of remote directory";
-char disconhelp[] = "terminate ftp session";
-char domachelp[] = "execute macro";
-char formhelp[] = "set file transfer format";
-char globhelp[] = "toggle metacharacter expansion of local file names";
-char hashhelp[] = "toggle printing `#' for each buffer transferred";
-char helphelp[] = "print local help information";
-char idlehelp[] = "get (set) idle timer on remote side";
-char lcdhelp[] = "change local working directory";
-char lshelp[] = "list contents of remote directory";
-char macdefhelp[] = "define a macro";
-char mdeletehelp[] = "delete multiple files";
-char mdirhelp[] = "list contents of multiple remote directories";
-char mgethelp[] = "get multiple files";
-char mkdirhelp[] = "make directory on the remote machine";
-char mlshelp[] = "list contents of multiple remote directories";
-char modtimehelp[] = "show last modification time of remote file";
-char modehelp[] = "set file transfer mode";
-char mputhelp[] = "send multiple files";
-char newerhelp[] = "get file if remote file is newer than local file ";
-char nlisthelp[] = "nlist contents of remote directory";
-char nmaphelp[] = "set templates for default file name mapping";
-char ntranshelp[] = "set translation table for default file name mapping";
-char porthelp[] = "toggle use of PORT cmd for each data connection";
-char prompthelp[] = "force interactive prompting on multiple commands";
-char proxyhelp[] = "issue command on alternate connection";
-char pwdhelp[] = "print working directory on remote machine";
-char quithelp[] = "terminate ftp session and exit";
-char quotehelp[] = "send arbitrary ftp command";
-char receivehelp[] = "receive file";
-char regethelp[] = "get file restarting at end of local file";
-char remotehelp[] = "get help from remote server";
-char renamehelp[] = "rename file";
-char restarthelp[]= "restart file transfer at bytecount";
-char rmdirhelp[] = "remove directory on the remote machine";
-char rmtstatushelp[]="show status of remote machine";
-char runiquehelp[] = "toggle store unique for local files";
-char resethelp[] = "clear queued command replies";
-char sendhelp[] = "send one file";
-char passivehelp[] = "enter passive transfer mode";
-char sitehelp[] = "send site specific command to remote server\n\t\tTry \"rhelp site\" or \"site help\" for more information";
-char shellhelp[] = "escape to the shell";
-char sizecmdhelp[] = "show size of remote file";
-char statushelp[] = "show current status";
-char structhelp[] = "set file transfer structure";
-char suniquehelp[] = "toggle store unique on remote machine";
-char systemhelp[] = "show remote system type";
-char tenexhelp[] = "set tenex file transfer type";
-char tracehelp[] = "toggle packet tracing";
-char typehelp[] = "set file transfer type";
-char umaskhelp[] = "get (set) umask on remote side";
-char userhelp[] = "send new user information";
-char verbosehelp[] = "toggle verbose mode";
-
-char prothelp[] = "set protection level";
-char prothelp_c[] = "set command protection level";
-#if defined(KRB5)
-char klisthelp[] = "show remote tickets";
-#endif
-#if defined(KRB5)
-char afsloghelp[] = "obtain remote AFS tokens";
-#endif
-
-struct cmd cmdtab[] = {
- { "!", shellhelp, 0, 0, 0, shell },
- { "$", domachelp, 1, 0, 0, domacro },
- { "account", accounthelp, 0, 1, 1, account},
- { "append", appendhelp, 1, 1, 1, put },
- { "ascii", asciihelp, 0, 1, 1, setascii },
- { "bell", beephelp, 0, 0, 0, setbell },
- { "binary", binaryhelp, 0, 1, 1, setbinary },
- { "bye", quithelp, 0, 0, 0, quit },
- { "case", casehelp, 0, 0, 1, setcase },
- { "cd", cdhelp, 0, 1, 1, cd },
- { "cdup", cduphelp, 0, 1, 1, cdup },
- { "chmod", chmodhelp, 0, 1, 1, do_chmod },
- { "close", disconhelp, 0, 1, 1, disconnect },
- { "cr", crhelp, 0, 0, 0, setcr },
- { "delete", deletehelp, 0, 1, 1, delete },
- { "debug", debughelp, 0, 0, 0, setdebug },
- { "dir", dirhelp, 1, 1, 1, ls },
- { "disconnect", disconhelp, 0, 1, 1, disconnect },
- { "form", formhelp, 0, 1, 1, setform },
- { "get", receivehelp, 1, 1, 1, get },
- { "glob", globhelp, 0, 0, 0, setglob },
- { "hash", hashhelp, 0, 0, 0, sethash },
- { "help", helphelp, 0, 0, 1, help },
- { "idle", idlehelp, 0, 1, 1, ftp_idle },
- { "image", binaryhelp, 0, 1, 1, setbinary },
- { "lcd", lcdhelp, 0, 0, 0, lcd },
- { "ls", lshelp, 1, 1, 1, ls },
- { "macdef", macdefhelp, 0, 0, 0, macdef },
- { "mdelete", mdeletehelp, 1, 1, 1, mdelete },
- { "mdir", mdirhelp, 1, 1, 1, mls },
- { "mget", mgethelp, 1, 1, 1, mget },
- { "mkdir", mkdirhelp, 0, 1, 1, makedir },
- { "mls", mlshelp, 1, 1, 1, mls },
- { "mode", modehelp, 0, 1, 1, setftmode },
- { "modtime", modtimehelp, 0, 1, 1, modtime },
- { "mput", mputhelp, 1, 1, 1, mput },
- { "newer", newerhelp, 1, 1, 1, newer },
- { "nmap", nmaphelp, 0, 0, 1, setnmap },
- { "nlist", nlisthelp, 1, 1, 1, ls },
- { "ntrans", ntranshelp, 0, 0, 1, setntrans },
- { "open", connecthelp, 0, 0, 1, setpeer },
- { "passive", passivehelp, 0, 0, 0, setpassive },
- { "prompt", prompthelp, 0, 0, 0, setprompt },
- { "proxy", proxyhelp, 0, 0, 1, doproxy },
- { "sendport", porthelp, 0, 0, 0, setport },
- { "put", sendhelp, 1, 1, 1, put },
- { "pwd", pwdhelp, 0, 1, 1, pwd },
- { "quit", quithelp, 0, 0, 0, quit },
- { "quote", quotehelp, 1, 1, 1, quote },
- { "recv", receivehelp, 1, 1, 1, get },
- { "reget", regethelp, 1, 1, 1, reget },
- { "rstatus", rmtstatushelp, 0, 1, 1, rmtstatus },
- { "rhelp", remotehelp, 0, 1, 1, rmthelp },
- { "rename", renamehelp, 0, 1, 1, renamefile },
- { "reset", resethelp, 0, 1, 1, reset },
- { "restart", restarthelp, 1, 1, 1, restart },
- { "rmdir", rmdirhelp, 0, 1, 1, removedir },
- { "runique", runiquehelp, 0, 0, 1, setrunique },
- { "send", sendhelp, 1, 1, 1, put },
- { "site", sitehelp, 0, 1, 1, site },
- { "size", sizecmdhelp, 1, 1, 1, sizecmd },
- { "status", statushelp, 0, 0, 1, status },
- { "struct", structhelp, 0, 1, 1, setstruct },
- { "system", systemhelp, 0, 1, 1, syst },
- { "sunique", suniquehelp, 0, 0, 1, setsunique },
- { "tenex", tenexhelp, 0, 1, 1, settenex },
- { "trace", tracehelp, 0, 0, 0, settrace },
- { "type", typehelp, 0, 1, 1, settype },
- { "user", userhelp, 0, 1, 1, user },
- { "umask", umaskhelp, 0, 1, 1, do_umask },
- { "verbose", verbosehelp, 0, 0, 0, setverbose },
- { "?", helphelp, 0, 0, 1, help },
-
- { "protect", prothelp, 0, 1, 0, sec_prot },
- /* what MIT uses */
- { "cprotect", prothelp_c, 0, 1, 1, sec_prot_command },
-#if defined(KRB5)
- { "klist", klisthelp, 0, 1, 0, klist },
-#endif
-#if defined(KRB5)
- { "afslog", afsloghelp, 0, 1, 0, afslog },
-#endif
-
- { 0 },
-};
-
-int NCMDS = (sizeof (cmdtab) / sizeof (cmdtab[0])) - 1;
diff --git a/appl/ftp/ftp/domacro.c b/appl/ftp/ftp/domacro.c
deleted file mode 100644
index 4311d69e02c1..000000000000
--- a/appl/ftp/ftp/domacro.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 1985, 1993, 1994
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "ftp_locl.h"
-RCSID("$Id$");
-
-void
-domacro(int argc, char **argv)
-{
- int i, j, count = 2, loopflg = 0;
- char *cp1, *cp2, line2[200];
- struct cmd *c;
-
- if (argc < 2 && !another(&argc, &argv, "macro name")) {
- printf("Usage: %s macro_name.\n", argv[0]);
- code = -1;
- return;
- }
- for (i = 0; i < macnum; ++i) {
- if (!strncmp(argv[1], macros[i].mac_name, 9)) {
- break;
- }
- }
- if (i == macnum) {
- printf("'%s' macro not found.\n", argv[1]);
- code = -1;
- return;
- }
- strlcpy(line2, line, sizeof(line2));
-TOP:
- cp1 = macros[i].mac_start;
- while (cp1 != macros[i].mac_end) {
- while (isspace((unsigned char)*cp1)) {
- cp1++;
- }
- cp2 = line;
- while (*cp1 != '\0') {
- size_t len;
- switch(*cp1) {
- case '\\':
- if (line + sizeof(line) - 2 < cp2)
- goto out;
- *cp2++ = *++cp1;
- break;
- case '$':
- if (isdigit((unsigned char)*(cp1+1))) {
- j = 0;
- while (isdigit((unsigned char)*++cp1)) {
- j = 10*j + *cp1 - '0';
- }
- cp1--;
- if (argc - 2 >= j) {
- len = sizeof(line) - (cp2 - line) - 1;
- if (strlcpy(cp2, argv[j+1], len) >= len)
- goto out;
- cp2 += strlen(argv[j+1]);
- }
- break;
- }
- if (*(cp1+1) == 'i') {
- loopflg = 1;
- cp1++;
- if (count < argc) {
- len = sizeof(line) - (cp2 - line) - 1;
- if (strlcpy(cp2, argv[count], len) >= len)
- goto out;
- cp2 += strlen(argv[count]);
- }
- break;
- }
- /* intentional drop through */
- default:
- if (line + sizeof(line) - 2 < cp2)
- goto out;
- *cp2++ = *cp1;
- break;
- }
- if (*cp1 != '\0') {
- cp1++;
- }
- }
- out:
- *cp2 = '\0';
- makeargv();
- c = getcmd(margv[0]);
- if (c == (struct cmd *)-1) {
- printf("?Ambiguous command\n");
- code = -1;
- }
- else if (c == 0) {
- printf("?Invalid command\n");
- code = -1;
- }
- else if (c->c_conn && !connected) {
- printf("Not connected.\n");
- code = -1;
- }
- else {
- if (verbose) {
- printf("%s\n",line);
- }
- (*c->c_handler)(margc, margv);
- if (bell && c->c_bell) {
- putchar('\007');
- }
- strlcpy(line, line2, sizeof(line));
- makeargv();
- argc = margc;
- argv = margv;
- }
- if (cp1 != macros[i].mac_end) {
- cp1++;
- }
- }
- if (loopflg && ++count < argc) {
- goto TOP;
- }
-}
diff --git a/appl/ftp/ftp/extern.h b/appl/ftp/ftp/extern.h
deleted file mode 100644
index ee5184957fb1..000000000000
--- a/appl/ftp/ftp/extern.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/*-
- * Copyright (c) 1994 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)extern.h 8.3 (Berkeley) 10/9/94
- */
-
-/* $Id$ */
-
-#include <setjmp.h>
-#include <stdlib.h>
-#ifdef TIME_WITH_SYS_TIME
-#include <sys/time.h>
-#include <time.h>
-#elif defined(HAVE_SYS_TIME_H)
-#include <sys/time.h>
-#else
-#include <time.h>
-#endif
-#ifdef HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
-
-void abort_remote (FILE *);
-void abortpt (int);
-void abortrecv (int);
-void account (int, char **);
-int another (int *, char ***, char *);
-void blkfree (char **);
-void cd (int, char **);
-void cdup (int, char **);
-void changetype (int, int);
-void cmdabort (int);
-void cmdscanner (int);
-int command (char *fmt, ...)
- __attribute__ ((format (printf, 1,2)));
-int confirm (char *, char *);
-FILE *dataconn (const char *);
-void delete (int, char **);
-void disconnect (int, char **);
-void do_chmod (int, char **);
-void do_umask (int, char **);
-void domacro (int, char **);
-char *domap (char *);
-void doproxy (int, char **);
-char *dotrans (char *);
-int empty (fd_set *, int);
-void fatal (char *);
-void get (int, char **);
-struct cmd *getcmd (char *);
-int getit (int, char **, int, char *);
-int getreply (int);
-int globulize (char **);
-char *gunique (char *);
-void help (int, char **);
-char *hookup (const char *, int);
-void ftp_idle (int, char **);
-int initconn (void);
-void intr (int);
-void lcd (int, char **);
-int login (char *);
-RETSIGTYPE lostpeer (int);
-void ls (int, char **);
-void macdef (int, char **);
-void makeargv (void);
-void makedir (int, char **);
-void mdelete (int, char **);
-void mget (int, char **);
-void mls (int, char **);
-void modtime (int, char **);
-void mput (int, char **);
-char *onoff (int);
-void newer (int, char **);
-void proxtrans (char *, char *, char *);
-void psabort (int);
-void pswitch (int);
-void ptransfer (char *, long, struct timeval *, struct timeval *);
-void put (int, char **);
-void pwd (int, char **);
-void quit (int, char **);
-void quote (int, char **);
-void quote1 (char *, int, char **);
-void recvrequest (char *, char *, char *, char *, int, int);
-void reget (int, char **);
-char *remglob (char **, int);
-void removedir (int, char **);
-void renamefile (int, char **);
-void reset (int, char **);
-void restart (int, char **);
-void rmthelp (int, char **);
-void rmtstatus (int, char **);
-int ruserpassword (char *, char **, char **, char **);
-void sendrequest (char *, char *, char *, char *, int);
-void setascii (int, char **);
-void setbell (int, char **);
-void setbinary (int, char **);
-void setcase (int, char **);
-void setcr (int, char **);
-void setdebug (int, char **);
-void setform (int, char **);
-void setftmode (int, char **);
-void setglob (int, char **);
-void sethash (int, char **);
-void setnmap (int, char **);
-void setntrans (int, char **);
-void setpassive (int, char **);
-void setpeer (int, char **);
-void setport (int, char **);
-void setprompt (int, char **);
-void setrunique (int, char **);
-void setstruct (int, char **);
-void setsunique (int, char **);
-void settenex (int, char **);
-void settrace (int, char **);
-void settype (int, char **);
-void setverbose (int, char **);
-void shell (int, char **);
-void site (int, char **);
-void sizecmd (int, char **);
-char *slurpstring (void);
-void status (int, char **);
-void syst (int, char **);
-void tvsub (struct timeval *, struct timeval *, struct timeval *);
-void user (int, char **);
-
-extern jmp_buf abortprox;
-extern int abrtflag;
-extern struct cmd cmdtab[];
-extern FILE *cout;
-extern int data;
-extern char *home;
-extern jmp_buf jabort;
-extern int proxy;
-extern char reply_string[];
-extern off_t restart_point;
-extern int NCMDS;
-
-extern char username[32];
-extern char myhostname[];
-extern char *mydomain;
-
-void afslog (int, char **);
-void kauth (int, char **);
-void kdestroy (int, char **);
-void klist (int, char **);
-void krbtkfile (int, char **);
diff --git a/appl/ftp/ftp/ftp.1 b/appl/ftp/ftp/ftp.1
deleted file mode 100644
index b0a837d863f5..000000000000
--- a/appl/ftp/ftp/ftp.1
+++ /dev/null
@@ -1,1211 +0,0 @@
-.\" $NetBSD: ftp.1,v 1.11 1995/09/08 01:06:24 tls Exp $
-.\"
-.\" Copyright (c) 1985, 1989, 1990, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)ftp.1 8.3 (Berkeley) 10/9/94
-.\"
-.Dd March 23, 2006
-.Dt FTP 1
-.Os BSD 4.2
-.Sh NAME
-.Nm ftp
-.Nd
-.Tn ARPANET
-file transfer program
-.Sh SYNOPSIS
-.Nm ftp
-.Op Fl K
-.Op Fl d
-.Op Fl g
-.Op Fl i
-.Op Fl l
-.Op Fl n
-.Op Fl p
-.Op Fl t
-.Op Fl v
-.Op Fl x
-.Op Fl Fl no-gss-bindings
-.Op Fl Fl no-gss-delegate
-.Op Ar host
-.Sh DESCRIPTION
-.Nm
-is the user interface to the
-.Tn ARPANET
-standard File Transfer Protocol.
-The program allows a user to transfer files to and from a
-remote network site.
-.Pp
-Modifications have been made so that it almost follows the FTP
-Security Extensions, RFC 2228.
-.Pp
-Options may be specified at the command line, or to the
-command interpreter.
-.Bl -tag -width flag
-.It Fl K
-Disable Kerberos authentication.
-.It Fl t
-Enables packet tracing.
-.It Fl v
-Verbose option forces
-.Nm ftp
-to show all responses from the remote server, as well
-as report on data transfer statistics.
-.It Fl n
-Restrains
-.Nm ftp
-from attempting \*(Lqauto-login\*(Rq upon initial connection.
-If auto-login is enabled,
-.Nm ftp
-will check the
-.Pa .netrc
-(see below) file in the user's home directory for an entry describing
-an account on the remote machine.
-If no entry exists,
-.Nm ftp
-will prompt for the remote machine login name (default is the user
-identity on the local machine), and, if necessary, prompt for a password
-and an account with which to login.
-.It Fl i
-Turns off interactive prompting during
-multiple file transfers.
-.It Fl p
-Turn on passive mode.
-.It Fl d
-Enables debugging.
-.It Fl g
-Disables file name globbing.
- .It Fl Fl no-gss-bindings
-Don't use GSS-API bindings when talking to peer. IP addresses will not
-be checked to ensure they match.
-.It Fl Fl no-gss-delegate
-Disable delegation of GSSAPI credentials.
-.It Fl l
-Disables command line editing.
-.It Fl x
-Encrypt command and data channel.
-.El
-.Pp
-The client host with which
-.Nm ftp
-is to communicate may be specified on the command line.
-If this is done,
-.Nm ftp
-will immediately attempt to establish a connection to an
-.Tn FTP
-server on that host; otherwise,
-.Nm ftp
-will enter its command interpreter and await instructions
-from the user.
-When
-.Nm ftp
-is awaiting commands from the user the prompt
-.Ql ftp\*[Gt]
-is provided to the user.
-The following commands are recognized
-by
-.Nm ftp :
-.Bl -tag -width Fl
-.It Ic \&! Op Ar command Op Ar args
-Invoke an interactive shell on the local machine.
-If there are arguments, the first is taken to be a command to execute
-directly, with the rest of the arguments as its arguments.
-.It Ic \&$ Ar macro-name Op Ar args
-Execute the macro
-.Ar macro-name
-that was defined with the
-.Ic macdef
-command.
-Arguments are passed to the macro unglobbed.
-.It Ic account Op Ar passwd
-Supply a supplemental password required by a remote system for access
-to resources once a login has been successfully completed.
-If no argument is included, the user will be prompted for an account
-password in a non-echoing input mode.
-.It Ic append Ar local-file Op Ar remote-file
-Append a local file to a file on the remote machine.
-If
-.Ar remote-file
-is left unspecified, the local file name is used in naming the
-remote file after being altered by any
-.Ic ntrans
-or
-.Ic nmap
-setting.
-File transfer uses the current settings for
-.Ic type ,
-.Ic format ,
-.Ic mode ,
-and
-.Ic structure .
-.It Ic ascii
-Set the file transfer
-.Ic type
-to network
-.Tn ASCII .
-This is the default type.
-.It Ic bell
-Arrange that a bell be sounded after each file transfer
-command is completed.
-.It Ic binary
-Set the file transfer
-.Ic type
-to support binary image transfer.
-.It Ic bye
-Terminate the
-.Tn FTP
-session with the remote server
-and exit
-.Nm ftp .
-An end of file will also terminate the session and exit.
-.It Ic case
-Toggle remote computer file name case mapping during
-.Ic mget
-commands.
-When
-.Ic case
-is on (default is off), remote computer file names with all letters in
-upper case are written in the local directory with the letters mapped
-to lower case.
-.It Ic \&cd Ar remote-directory
-Change the working directory on the remote machine
-to
-.Ar remote-directory .
-.It Ic cdup
-Change the remote machine working directory to the parent of the
-current remote machine working directory.
-.It Ic chmod Ar mode file-name
-Change the permission modes of the file
-.Ar file-name
-on the remote
-sytem to
-.Ar mode .
-.It Ic close
-Terminate the
-.Tn FTP
-session with the remote server, and
-return to the command interpreter.
-Any defined macros are erased.
-.It Ic \&cr
-Toggle carriage return stripping during
-ascii type file retrieval.
-Records are denoted by a carriage return/linefeed sequence
-during ascii type file transfer.
-When
-.Ic \&cr
-is on (the default), carriage returns are stripped from this
-sequence to conform with the
-.Ux
-single linefeed record
-delimiter.
-Records on
-.Pf non\- Ns Ux
-remote systems may contain single linefeeds;
-when an ascii type transfer is made, these linefeeds may be
-distinguished from a record delimiter only when
-.Ic \&cr
-is off.
-.It Ic delete Ar remote-file
-Delete the file
-.Ar remote-file
-on the remote machine.
-.It Ic debug Op Ar debug-value
-Toggle debugging mode.
-If an optional
-.Ar debug-value
-is specified it is used to set the debugging level.
-When debugging is on,
-.Nm ftp
-prints each command sent to the remote machine, preceded
-by the string
-.Ql \-\-\*[Gt]
-.It Xo
-.Ic dir
-.Op Ar remote-directory
-.Op Ar local-file
-.Xc
-Print a listing of the directory contents in the
-directory,
-.Ar remote-directory ,
-and, optionally, placing the output in
-.Ar local-file .
-If interactive prompting is on,
-.Nm ftp
-will prompt the user to verify that the last argument is indeed the
-target local file for receiving
-.Ic dir
-output.
-If no directory is specified, the current working
-directory on the remote machine is used.
-If no local
-file is specified, or
-.Ar local-file
-is
-.Fl ,
-output comes to the terminal.
-.It Ic disconnect
-A synonym for
-.Ar close .
-.It Ic form Ar format
-Set the file transfer
-.Ic form
-to
-.Ar format .
-The default format is \*(Lqfile\*(Rq.
-.It Ic get Ar remote-file Op Ar local-file
-Retrieve the
-.Ar remote-file
-and store it on the local machine.
-If the local
-file name is not specified, it is given the same
-name it has on the remote machine, subject to
-alteration by the current
-.Ic case ,
-.Ic ntrans ,
-and
-.Ic nmap
-settings.
-The current settings for
-.Ic type ,
-.Ic form ,
-.Ic mode ,
-and
-.Ic structure
-are used while transferring the file.
-.It Ic glob
-Toggle filename expansion for
-.Ic mdelete ,
-.Ic mget
-and
-.Ic mput .
-If globbing is turned off with
-.Ic glob ,
-the file name arguments
-are taken literally and not expanded.
-Globbing for
-.Ic mput
-is done as in
-.Xr csh 1 .
-For
-.Ic mdelete
-and
-.Ic mget ,
-each remote file name is expanded
-separately on the remote machine and the lists are not merged.
-Expansion of a directory name is likely to be
-different from expansion of the name of an ordinary file:
-the exact result depends on the foreign operating system and ftp server,
-and can be previewed by doing
-.Ql mls remote-files \- .
-As a security measure, remotely globbed files that starts with
-.Sq /
-or contains
-.Sq ../ ,
-will not be automatically received. If you have interactive prompting
-turned off, these filenames will be ignored. Note:
-.Ic mget
-and
-.Ic mput
-are not meant to transfer
-entire directory subtrees of files.
-That can be done by
-transferring a
-.Xr tar 1
-archive of the subtree (in binary mode).
-.It Ic hash
-Toggle hash-sign (``#'') printing for each data block
-transferred.
-The size of a data block is 1024 bytes.
-.It Ic help Op Ar command
-Print an informative message about the meaning of
-.Ar command .
-If no argument is given,
-.Nm ftp
-prints a list of the known commands.
-.It Ic idle Op Ar seconds
-Set the inactivity timer on the remote server to
-.Ar seconds
-seconds.
-If
-.Ar seconds
-is omitted, the current inactivity timer is printed.
-.It Ic lcd Op Ar directory
-Change the working directory on the local machine.
-If
-no
-.Ar directory
-is specified, the user's home directory is used.
-.It Xo
-.Ic \&ls
-.Op Ar remote-directory
-.Op Ar local-file
-.Xc
-Print a listing of the contents of a
-directory on the remote machine.
-The listing includes any system-dependent information that the server
-chooses to include; for example, most
-.Ux
-systems will produce
-output from the command
-.Ql ls \-l .
-(See also
-.Ic nlist . )
-If
-.Ar remote-directory
-is left unspecified, the current working directory is used.
-If interactive prompting is on,
-.Nm ftp
-will prompt the user to verify that the last argument is indeed the
-target local file for receiving
-.Ic \&ls
-output.
-If no local file is specified, or if
-.Ar local-file
-is
-.Sq Fl ,
-the output is sent to the terminal.
-.It Ic macdef Ar macro-name
-Define a macro.
-Subsequent lines are stored as the macro
-.Ar macro-name ;
-a null line (consecutive newline characters
-in a file or
-carriage returns from the terminal) terminates macro input mode.
-There is a limit of 16 macros and 4096 total characters in all
-defined macros.
-Macros remain defined until a
-.Ic close
-command is executed.
-The macro processor interprets `$' and `\e' as special characters.
-A `$' followed by a number (or numbers) is replaced by the
-corresponding argument on the macro invocation command line.
-A `$' followed by an `i' signals that macro processor that the
-executing macro is to be looped.
-On the first pass `$i' is
-replaced by the first argument on the macro invocation command line,
-on the second pass it is replaced by the second argument, and so on.
-A `\e' followed by any character is replaced by that character.
-Use the `\e' to prevent special treatment of the `$'.
-.It Ic mdelete Op Ar remote-files
-Delete the
-.Ar remote-files
-on the remote machine.
-.It Ic mdir Ar remote-files local-file
-Like
-.Ic dir ,
-except multiple remote files may be specified.
-If interactive prompting is on,
-.Nm ftp
-will prompt the user to verify that the last argument is indeed the
-target local file for receiving
-.Ic mdir
-output.
-.It Ic mget Ar remote-files
-Expand the
-.Ar remote-files
-on the remote machine
-and do a
-.Ic get
-for each file name thus produced.
-See
-.Ic glob
-for details on the filename expansion.
-Resulting file names will then be processed according to
-.Ic case ,
-.Ic ntrans ,
-and
-.Ic nmap
-settings.
-Files are transferred into the local working directory,
-which can be changed with
-.Ql lcd directory ;
-new local directories can be created with
-.Ql "\&! mkdir directory" .
-.It Ic mkdir Ar directory-name
-Make a directory on the remote machine.
-.It Ic mls Ar remote-files local-file
-Like
-.Ic nlist ,
-except multiple remote files may be specified,
-and the
-.Ar local-file
-must be specified.
-If interactive prompting is on,
-.Nm ftp
-will prompt the user to verify that the last argument is indeed the
-target local file for receiving
-.Ic mls
-output.
-.It Ic mode Op Ar mode-name
-Set the file transfer
-.Ic mode
-to
-.Ar mode-name .
-The default mode is \*(Lqstream\*(Rq mode.
-.It Ic modtime Ar file-name
-Show the last modification time of the file on the remote machine.
-.It Ic mput Ar local-files
-Expand wild cards in the list of local files given as arguments
-and do a
-.Ic put
-for each file in the resulting list.
-See
-.Ic glob
-for details of filename expansion.
-Resulting file names will then be processed according to
-.Ic ntrans
-and
-.Ic nmap
-settings.
-.It Ic newer Ar file-name
-Get the file only if the modification time of the remote file is more
-recent that the file on the current system.
-If the file does not
-exist on the current system, the remote file is considered
-.Ic newer .
-Otherwise, this command is identical to
-.Ar get .
-.It Xo
-.Ic nlist
-.Op Ar remote-directory
-.Op Ar local-file
-.Xc
-Print a list of the files in a
-directory on the remote machine.
-If
-.Ar remote-directory
-is left unspecified, the current working directory is used.
-If interactive prompting is on,
-.Nm ftp
-will prompt the user to verify that the last argument is indeed the
-target local file for receiving
-.Ic nlist
-output.
-If no local file is specified, or if
-.Ar local-file
-is
-.Fl ,
-the output is sent to the terminal.
-.It Ic nmap Op Ar inpattern outpattern
-Set or unset the filename mapping mechanism.
-If no arguments are specified, the filename mapping mechanism is unset.
-If arguments are specified, remote filenames are mapped during
-.Ic mput
-commands and
-.Ic put
-commands issued without a specified remote target filename.
-If arguments are specified, local filenames are mapped during
-.Ic mget
-commands and
-.Ic get
-commands issued without a specified local target filename.
-This command is useful when connecting to a
-.No non\- Ns Ux
-remote computer
-with different file naming conventions or practices.
-The mapping follows the pattern set by
-.Ar inpattern
-and
-.Ar outpattern .
-.Op Ar Inpattern
-is a template for incoming filenames (which may have already been
-processed according to the
-.Ic ntrans
-and
-.Ic case
-settings).
-Variable templating is accomplished by including the
-sequences `$1', `$2', ..., `$9' in
-.Ar inpattern .
-Use `\\' to prevent this special treatment of the `$' character.
-All other characters are treated literally, and are used to determine the
-.Ic nmap
-.Op Ar inpattern
-variable values.
-For example, given
-.Ar inpattern
-$1.$2 and the remote file name "mydata.data", $1 would have the value
-"mydata", and $2 would have the value "data".
-The
-.Ar outpattern
-determines the resulting mapped filename.
-The sequences `$1', `$2', ...., `$9' are replaced by any value resulting
-from the
-.Ar inpattern
-template.
-The sequence `$0' is replace by the original filename.
-Additionally, the sequence
-.Ql Op Ar seq1 , Ar seq2
-is replaced by
-.Op Ar seq1
-if
-.Ar seq1
-is not a null string; otherwise it is replaced by
-.Ar seq2 .
-For example, the command
-.Pp
-.Bd -literal -offset indent -compact
-nmap $1.$2.$3 [$1,$2].[$2,file]
-.Ed
-.Pp
-would yield
-the output filename "myfile.data" for input filenames "myfile.data" and
-"myfile.data.old", "myfile.file" for the input filename "myfile", and
-"myfile.myfile" for the input filename ".myfile".
-Spaces may be included in
-.Ar outpattern ,
-as in the example: `nmap $1 sed "s/ *$//" \*[Gt] $1' .
-Use the `\e' character to prevent special treatment
-of the `$','[','[', and `,' characters.
-.It Ic ntrans Op Ar inchars Op Ar outchars
-Set or unset the filename character translation mechanism.
-If no arguments are specified, the filename character
-translation mechanism is unset.
-If arguments are specified, characters in
-remote filenames are translated during
-.Ic mput
-commands and
-.Ic put
-commands issued without a specified remote target filename.
-If arguments are specified, characters in
-local filenames are translated during
-.Ic mget
-commands and
-.Ic get
-commands issued without a specified local target filename.
-This command is useful when connecting to a
-.No non\- Ns Ux
-remote computer
-with different file naming conventions or practices.
-Characters in a filename matching a character in
-.Ar inchars
-are replaced with the corresponding character in
-.Ar outchars .
-If the character's position in
-.Ar inchars
-is longer than the length of
-.Ar outchars ,
-the character is deleted from the file name.
-.It Ic open Ar host Op Ar port
-Establish a connection to the specified
-.Ar host
-.Tn FTP
-server.
-An optional port number may be supplied,
-in which case,
-.Nm ftp
-will attempt to contact an
-.Tn FTP
-server at that port.
-If the
-.Ic auto-login
-option is on (default),
-.Nm ftp
-will also attempt to automatically log the user in to
-the
-.Tn FTP
-server (see below).
-.It Ic passive
-Toggle passive mode. If passive mode is turned on
-(default is off), the ftp client will
-send a
-.Dv PASV
-command for all data connections instead of the usual
-.Dv PORT
-command. The
-.Dv PASV
-command requests that the remote server open a port for the data connection
-and return the address of that port. The remote server listens on that
-port and the client connects to it. When using the more traditional
-.Dv PORT
-command, the client listens on a port and sends that address to the remote
-server, who connects back to it. Passive mode is useful when using
-.Nm ftp
-through a gateway router or host that controls the directionality of
-traffic.
-(Note that though ftp servers are required to support the
-.Dv PASV
-command by RFC 1123, some do not.)
-.It Ic prompt
-Toggle interactive prompting.
-Interactive prompting
-occurs during multiple file transfers to allow the
-user to selectively retrieve or store files.
-If prompting is turned off (default is on), any
-.Ic mget
-or
-.Ic mput
-will transfer all files, and any
-.Ic mdelete
-will delete all files.
-.It Ic proxy Ar ftp-command
-Execute an ftp command on a secondary control connection.
-This command allows simultaneous connection to two remote ftp
-servers for transferring files between the two servers.
-The first
-.Ic proxy
-command should be an
-.Ic open ,
-to establish the secondary control connection.
-Enter the command "proxy ?" to see other ftp commands executable on the
-secondary connection.
-The following commands behave differently when prefaced by
-.Ic proxy :
-.Ic open
-will not define new macros during the auto-login process,
-.Ic close
-will not erase existing macro definitions,
-.Ic get
-and
-.Ic mget
-transfer files from the host on the primary control connection
-to the host on the secondary control connection, and
-.Ic put ,
-.Ic mput ,
-and
-.Ic append
-transfer files from the host on the secondary control connection
-to the host on the primary control connection.
-Third party file transfers depend upon support of the ftp protocol
-.Dv PASV
-command by the server on the secondary control connection.
-.It Ic put Ar local-file Op Ar remote-file
-Store a local file on the remote machine.
-If
-.Ar remote-file
-is left unspecified, the local file name is used
-after processing according to any
-.Ic ntrans
-or
-.Ic nmap
-settings
-in naming the remote file.
-File transfer uses the
-current settings for
-.Ic type ,
-.Ic format ,
-.Ic mode ,
-and
-.Ic structure .
-.It Ic pwd
-Print the name of the current working directory on the remote
-machine.
-.It Ic quit
-A synonym for
-.Ic bye .
-.It Ic quote Ar arg1 arg2 ...
-The arguments specified are sent, verbatim, to the remote
-.Tn FTP
-server.
-.It Ic recv Ar remote-file Op Ar local-file
-A synonym for get.
-.It Ic reget Ar remote-file Op Ar local-file
-Reget acts like get, except that if
-.Ar local-file
-exists and is
-smaller than
-.Ar remote-file ,
-.Ar local-file
-is presumed to be
-a partially transferred copy of
-.Ar remote-file
-and the transfer
-is continued from the apparent point of failure.
-This command
-is useful when transferring very large files over networks that
-are prone to dropping connections.
-.It Ic remotehelp Op Ar command-name
-Request help from the remote
-.Tn FTP
-server.
-If a
-.Ar command-name
-is specified it is supplied to the server as well.
-.It Ic remotestatus Op Ar file-name
-With no arguments, show status of remote machine.
-If
-.Ar file-name
-is specified, show status of
-.Ar file-name
-on remote machine.
-.It Xo
-.Ic rename
-.Op Ar from
-.Op Ar to
-.Xc
-Rename the file
-.Ar from
-on the remote machine, to the file
-.Ar to .
-.It Ic reset
-Clear reply queue.
-This command re-synchronizes command/reply sequencing with the remote
-ftp server.
-Resynchronization may be necessary following a violation of the ftp protocol
-by the remote server.
-.It Ic restart Ar marker
-Restart the immediately following
-.Ic get
-or
-.Ic put
-at the
-indicated
-.Ar marker .
-On
-.Ux
-systems, marker is usually a byte
-offset into the file.
-.It Ic rmdir Ar directory-name
-Delete a directory on the remote machine.
-.It Ic runique
-Toggle storing of files on the local system with unique filenames.
-If a file already exists with a name equal to the target
-local filename for a
-.Ic get
-or
-.Ic mget
-command, a ".1" is appended to the name.
-If the resulting name matches another existing file,
-a ".2" is appended to the original name.
-If this process continues up to ".99", an error
-message is printed, and the transfer does not take place.
-The generated unique filename will be reported.
-Note that
-.Ic runique
-will not affect local files generated from a shell command
-(see below).
-The default value is off.
-.It Ic send Ar local-file Op Ar remote-file
-A synonym for put.
-.It Ic sendport
-Toggle the use of
-.Dv PORT
-commands.
-By default,
-.Nm ftp
-will attempt to use a
-.Dv PORT
-command when establishing
-a connection for each data transfer.
-The use of
-.Dv PORT
-commands can prevent delays
-when performing multiple file transfers.
-If the
-.Dv PORT
-command fails,
-.Nm ftp
-will use the default data port.
-When the use of
-.Dv PORT
-commands is disabled, no attempt will be made to use
-.Dv PORT
-commands for each data transfer.
-This is useful
-for certain
-.Tn FTP
-implementations which do ignore
-.Dv PORT
-commands but, incorrectly, indicate they've been accepted.
-.It Ic site Ar arg1 arg2 ...
-The arguments specified are sent, verbatim, to the remote
-.Tn FTP
-server as a
-.Dv SITE
-command.
-.It Ic size Ar file-name
-Return size of
-.Ar file-name
-on remote machine.
-.It Ic status
-Show the current status of
-.Nm ftp .
-.It Ic struct Op Ar struct-name
-Set the file transfer
-.Ar structure
-to
-.Ar struct-name .
-By default \*(Lqstream\*(Rq structure is used.
-.It Ic sunique
-Toggle storing of files on remote machine under unique file names.
-Remote ftp server must support ftp protocol
-.Dv STOU
-command for
-successful completion.
-The remote server will report unique name.
-Default value is off.
-.It Ic system
-Show the type of operating system running on the remote machine.
-.It Ic tenex
-Set the file transfer type to that needed to
-talk to
-.Tn TENEX
-machines.
-.It Ic trace
-Toggle packet tracing.
-.It Ic type Op Ar type-name
-Set the file transfer
-.Ic type
-to
-.Ar type-name .
-If no type is specified, the current type
-is printed.
-The default type is network
-.Tn ASCII .
-.It Ic umask Op Ar newmask
-Set the default umask on the remote server to
-.Ar newmask .
-If
-.Ar newmask
-is omitted, the current umask is printed.
-.It Xo
-.Ic user Ar user-name
-.Op Ar password
-.Op Ar account
-.Xc
-Identify yourself to the remote
-.Tn FTP
-server.
-If the
-.Ar password
-is not specified and the server requires it,
-.Nm ftp
-will prompt the user for it (after disabling local echo).
-If an
-.Ar account
-field is not specified, and the
-.Tn FTP
-server
-requires it, the user will be prompted for it.
-If an
-.Ar account
-field is specified, an account command will
-be relayed to the remote server after the login sequence
-is completed if the remote server did not require it
-for logging in.
-Unless
-.Nm ftp
-is invoked with \*(Lqauto-login\*(Rq disabled, this
-process is done automatically on initial connection to
-the
-.Tn FTP
-server.
-.It Ic verbose
-Toggle verbose mode.
-In verbose mode, all responses from
-the
-.Tn FTP
-server are displayed to the user.
-In addition,
-if verbose is on, when a file transfer completes, statistics
-regarding the efficiency of the transfer are reported.
-By default,
-verbose is on.
-.It Ic \&? Op Ar command
-A synonym for help.
-.El
-.Pp
-The following command can be used with ftpsec-aware servers.
-.Bl -tag -width Fl
-.It Xo
-.Ic prot
-.Ar clear |
-.Ar safe |
-.Ar confidential |
-.Ar private
-.Xc
-Set the data protection level to the requested level.
-.El
-.Pp
-The following command can be used with ftp servers that has
-implemented the KAUTH site command.
-.Bl -tag -width Fl
-.It Ic kauth Op Ar principal
-Obtain remote tickets.
-.El
-.Pp
-Command arguments which have embedded spaces may be quoted with
-quote `"' marks.
-.Sh ABORTING A FILE TRANSFER
-To abort a file transfer, use the terminal interrupt key
-(usually Ctrl-C).
-Sending transfers will be immediately halted.
-Receiving transfers will be halted by sending a ftp protocol
-.Dv ABOR
-command to the remote server, and discarding any further data received.
-The speed at which this is accomplished depends upon the remote
-server's support for
-.Dv ABOR
-processing.
-If the remote server does not support the
-.Dv ABOR
-command, an
-.Ql ftp\*[Gt]
-prompt will not appear until the remote server has completed
-sending the requested file.
-.Pp
-The terminal interrupt key sequence will be ignored when
-.Nm ftp
-has completed any local processing and is awaiting a reply
-from the remote server.
-A long delay in this mode may result from the ABOR processing described
-above, or from unexpected behavior by the remote server, including
-violations of the ftp protocol.
-If the delay results from unexpected remote server behavior, the local
-.Nm ftp
-program must be killed by hand.
-.Sh FILE NAMING CONVENTIONS
-Files specified as arguments to
-.Nm ftp
-commands are processed according to the following rules.
-.Bl -enum
-.It
-If the file name
-.Sq Fl
-is specified, the
-.Ar stdin
-(for reading) or
-.Ar stdout
-(for writing) is used.
-.It
-If the first character of the file name is
-.Sq \&| ,
-the
-remainder of the argument is interpreted as a shell command.
-.Nm Ftp
-then forks a shell, using
-.Xr popen 3
-with the argument supplied, and reads (writes) from the stdout
-(stdin).
-If the shell command includes spaces, the argument
-must be quoted; e.g.
-\*(Lq" ls -lt"\*(Rq.
-A particularly
-useful example of this mechanism is: \*(Lqdir more\*(Rq.
-.It
-Failing the above checks, if ``globbing'' is enabled,
-local file names are expanded
-according to the rules used in the
-.Xr csh 1 ;
-c.f. the
-.Ic glob
-command.
-If the
-.Nm ftp
-command expects a single local file (.e.g.
-.Ic put ) ,
-only the first filename generated by the "globbing" operation is used.
-.It
-For
-.Ic mget
-commands and
-.Ic get
-commands with unspecified local file names, the local filename is
-the remote filename, which may be altered by a
-.Ic case ,
-.Ic ntrans ,
-or
-.Ic nmap
-setting.
-The resulting filename may then be altered if
-.Ic runique
-is on.
-.It
-For
-.Ic mput
-commands and
-.Ic put
-commands with unspecified remote file names, the remote filename is
-the local filename, which may be altered by a
-.Ic ntrans
-or
-.Ic nmap
-setting.
-The resulting filename may then be altered by the remote server if
-.Ic sunique
-is on.
-.El
-.Sh FILE TRANSFER PARAMETERS
-The FTP specification specifies many parameters which may
-affect a file transfer.
-The
-.Ic type
-may be one of \*(Lqascii\*(Rq, \*(Lqimage\*(Rq (binary),
-\*(Lqebcdic\*(Rq, and \*(Lqlocal byte size\*(Rq (for
-.Tn PDP Ns -10's
-and
-.Tn PDP Ns -20's
-mostly).
-.Nm Ftp
-supports the ascii and image types of file transfer,
-plus local byte size 8 for
-.Ic tenex
-mode transfers.
-.Pp
-.Nm Ftp
-supports only the default values for the remaining
-file transfer parameters:
-.Ic mode ,
-.Ic form ,
-and
-.Ic struct .
-.Sh THE .netrc FILE
-The
-.Pa .netrc
-file contains login and initialization information
-used by the auto-login process.
-It resides in the user's home directory.
-The following tokens are recognized; they may be separated by spaces,
-tabs, or new-lines:
-.Bl -tag -width password
-.It Ic machine Ar name
-Identify a remote machine
-.Ar name .
-The auto-login process searches the
-.Pa .netrc
-file for a
-.Ic machine
-token that matches the remote machine specified on the
-.Nm ftp
-command line or as an
-.Ic open
-command argument.
-Once a match is made, the subsequent
-.Pa .netrc
-tokens are processed,
-stopping when the end of file is reached or another
-.Ic machine
-or a
-.Ic default
-token is encountered.
-.It Ic default
-This is the same as
-.Ic machine
-.Ar name
-except that
-.Ic default
-matches any name.
-There can be only one
-.Ic default
-token, and it must be after all
-.Ic machine
-tokens.
-This is normally used as:
-.Pp
-.Dl default login anonymous password user@site
-.Pp
-thereby giving the user
-.Ar automatic
-anonymous ftp login to
-machines not specified in
-.Pa .netrc .
-This can be overridden
-by using the
-.Fl n
-flag to disable auto-login.
-.It Ic login Ar name
-Identify a user on the remote machine.
-If this token is present, the auto-login process will initiate
-a login using the specified
-.Ar name .
-.It Ic password Ar string
-Supply a password.
-If this token is present, the auto-login process will supply the
-specified string if the remote server requires a password as part
-of the login process.
-Note that if this token is present in the
-.Pa .netrc
-file for any user other
-than
-.Ar anonymous ,
-.Nm ftp
-will abort the auto-login process if the
-.Pa .netrc
-is readable by
-anyone besides the user.
-.It Ic account Ar string
-Supply an additional account password.
-If this token is present, the auto-login process will supply the
-specified string if the remote server requires an additional
-account password, or the auto-login process will initiate an
-.Dv ACCT
-command if it does not.
-.It Ic macdef Ar name
-Define a macro.
-This token functions like the
-.Nm ftp
-.Ic macdef
-command functions.
-A macro is defined with the specified name; its contents begin with the
-next
-.Pa .netrc
-line and continue until a null line (consecutive new-line
-characters) is encountered.
-If a macro named
-.Ic init
-is defined, it is automatically executed as the last step in the
-auto-login process.
-.El
-.Sh ENVIRONMENT
-.Nm Ftp
-uses the following environment variables.
-.Bl -tag -width Fl
-.It Ev HOME
-For default location of a
-.Pa .netrc
-file, if one exists.
-.It Ev SHELL
-For default shell.
-.El
-.Sh SEE ALSO
-.Xr ftpd 8
-.Rs
-.%T RFC2228
-.Re
-.Sh HISTORY
-The
-.Nm ftp
-command appeared in
-.Bx 4.2 .
-.Sh BUGS
-Correct execution of many commands depends upon proper behavior
-by the remote server.
-.Pp
-An error in the treatment of carriage returns
-in the
-.Bx 4.2
-ascii-mode transfer code
-has been corrected.
-This correction may result in incorrect transfers of binary files
-to and from
-.Bx 4.2
-servers using the ascii type.
-Avoid this problem by using the binary image type.
diff --git a/appl/ftp/ftp/ftp.c b/appl/ftp/ftp/ftp.c
deleted file mode 100644
index 1cd2f46ebb43..000000000000
--- a/appl/ftp/ftp/ftp.c
+++ /dev/null
@@ -1,1814 +0,0 @@
-/*
- * Copyright (c) 1985, 1989, 1993, 1994
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "ftp_locl.h"
-RCSID ("$Id$");
-
-struct sockaddr_storage hisctladdr_ss;
-struct sockaddr *hisctladdr = (struct sockaddr *)&hisctladdr_ss;
-struct sockaddr_storage data_addr_ss;
-struct sockaddr *data_addr = (struct sockaddr *)&data_addr_ss;
-struct sockaddr_storage myctladdr_ss;
-struct sockaddr *myctladdr = (struct sockaddr *)&myctladdr_ss;
-int data = -1;
-int abrtflag = 0;
-jmp_buf ptabort;
-int ptabflg;
-int ptflag = 0;
-off_t restart_point = 0;
-
-
-FILE *cin, *cout;
-
-typedef void (*sighand) (int);
-
-char *
-hookup (const char *host, int port)
-{
- static char hostnamebuf[MaxHostNameLen];
- struct addrinfo *ai, *a;
- struct addrinfo hints;
- int error;
- char portstr[NI_MAXSERV];
- socklen_t len;
- int s;
-
- memset (&hints, 0, sizeof(hints));
- hints.ai_socktype = SOCK_STREAM;
- hints.ai_protocol = IPPROTO_TCP;
- hints.ai_flags = AI_CANONNAME;
-
- snprintf (portstr, sizeof(portstr), "%u", ntohs(port));
-
- error = getaddrinfo (host, portstr, &hints, &ai);
- if (error) {
- warnx ("%s: %s", host, gai_strerror(error));
- code = -1;
- return NULL;
- }
- strlcpy (hostnamebuf, host, sizeof(hostnamebuf));
- hostname = hostnamebuf;
-
- s = -1;
- for (a = ai; a != NULL; a = a->ai_next) {
- s = socket (a->ai_family, a->ai_socktype, a->ai_protocol);
- if (s < 0)
- continue;
-
- if (a->ai_canonname != NULL)
- strlcpy (hostnamebuf, a->ai_canonname, sizeof(hostnamebuf));
-
- memcpy (hisctladdr, a->ai_addr, a->ai_addrlen);
-
- error = connect (s, a->ai_addr, a->ai_addrlen);
- if (error < 0) {
- char addrstr[256];
-
- if (getnameinfo (a->ai_addr, a->ai_addrlen,
- addrstr, sizeof(addrstr),
- NULL, 0, NI_NUMERICHOST) != 0)
- strlcpy (addrstr, "unknown address", sizeof(addrstr));
-
- warn ("connect %s", addrstr);
- close (s);
- s = -1;
- continue;
- }
- break;
- }
- freeaddrinfo (ai);
- if (s < 0) {
- warnx ("failed to contact %s", host);
- code = -1;
- return NULL;
- }
-
- len = sizeof(myctladdr_ss);
- if (getsockname (s, myctladdr, &len) < 0) {
- warn ("getsockname");
- code = -1;
- close (s);
- return NULL;
- }
-#ifdef IPTOS_LOWDELAY
- socket_set_tos (s, IPTOS_LOWDELAY);
-#endif
- cin = fdopen (s, "r");
- cout = fdopen (s, "w");
- if (cin == NULL || cout == NULL) {
- warnx ("fdopen failed.");
- if (cin)
- fclose (cin);
- if (cout)
- fclose (cout);
- code = -1;
- goto bad;
- }
- if (verbose)
- printf ("Connected to %s.\n", hostname);
- if (getreply (0) > 2) { /* read startup message from server */
- if (cin)
- fclose (cin);
- if (cout)
- fclose (cout);
- code = -1;
- goto bad;
- }
-#if defined(SO_OOBINLINE) && defined(HAVE_SETSOCKOPT)
- {
- int on = 1;
-
- if (setsockopt (s, SOL_SOCKET, SO_OOBINLINE, (char *) &on, sizeof (on))
- < 0 && debug) {
- warn ("setsockopt");
- }
- }
-#endif /* SO_OOBINLINE */
-
- return (hostname);
-bad:
- close (s);
- return NULL;
-}
-
-int
-login (char *host)
-{
- char tmp[80];
- char defaultpass[128];
- char *userstr, *pass, *acctstr;
- char *ruserstr, *rpass, *racctstr;
- int n, aflag = 0;
-
- char *myname = NULL;
- struct passwd *pw = k_getpwuid(getuid());
-
- if (pw != NULL)
- myname = pw->pw_name;
-
- ruserstr = rpass = racctstr = NULL;
-
- if(sec_login(host))
- printf("\n*** Using plaintext user and password ***\n\n");
- else{
- printf("Authentication successful.\n\n");
- }
-
- if (ruserpassword (host, &ruserstr, &rpass, &racctstr) < 0) {
- code = -1;
- return (0);
- }
- userstr = ruserstr;
- pass = rpass;
- acctstr = racctstr;
-
- while (userstr == NULL) {
- if (myname)
- printf ("Name (%s:%s): ", host, myname);
- else
- printf ("Name (%s): ", host);
- *tmp = '\0';
- if (fgets (tmp, sizeof (tmp) - 1, stdin) != NULL)
- tmp[strlen (tmp) - 1] = '\0';
- if (*tmp == '\0')
- userstr = myname;
- else
- userstr = tmp;
- }
- strlcpy(username, userstr, sizeof(username));
- if (ruserstr)
- free(ruserstr);
-
- n = command("USER %s", userstr);
- if (n == COMPLETE)
- n = command("PASS dummy"); /* DK: Compatibility with gssftp daemon */
- else if(n == CONTINUE) {
- if (pass == NULL) {
- char prompt[128];
- if(myname &&
- (!strcmp(userstr, "ftp") || !strcmp(userstr, "anonymous"))) {
- snprintf(defaultpass, sizeof(defaultpass),
- "%s@%s", myname, mydomain);
- snprintf(prompt, sizeof(prompt),
- "Password (%s): ", defaultpass);
- } else if (sec_complete) {
- pass = myname;
- } else {
- *defaultpass = '\0';
- snprintf(prompt, sizeof(prompt), "Password: ");
- }
- if (pass == NULL) {
- pass = defaultpass;
- UI_UTIL_read_pw_string (tmp, sizeof (tmp), prompt, 0);
- if (tmp[0])
- pass = tmp;
- }
- }
- n = command ("PASS %s", pass);
- if (rpass)
- free(rpass);
- }
- if (n == CONTINUE) {
- aflag++;
- UI_UTIL_read_pw_string (tmp, sizeof(tmp), "Account:", 0);
- acctstr = tmp;
- n = command ("ACCT %s", acctstr);
- }
- if (n != COMPLETE) {
- if (racctstr)
- free(racctstr);
- warnx ("Login failed.");
- return (0);
- }
- if (!aflag && acctstr != NULL)
- command ("ACCT %s", acctstr);
- if (racctstr)
- free(racctstr);
- if (proxy)
- return (1);
- for (n = 0; n < macnum; ++n) {
- if (!strcmp("init", macros[n].mac_name)) {
- strlcpy (line, "$init", sizeof (line));
- makeargv();
- domacro(margc, margv);
- break;
- }
- }
- sec_set_protection_level ();
- return (1);
-}
-
-void
-cmdabort (int sig)
-{
-
- printf ("\n");
- fflush (stdout);
- abrtflag++;
- if (ptflag)
- longjmp (ptabort, 1);
-}
-
-int
-command (char *fmt,...)
-{
- va_list ap;
- int r;
- sighand oldintr;
-
- abrtflag = 0;
- if (cout == NULL) {
- warn ("No control connection for command");
- code = -1;
- return (0);
- }
- oldintr = signal(SIGINT, cmdabort);
- if(debug){
- printf("---> ");
- if (strncmp("PASS ", fmt, 5) == 0)
- printf("PASS XXXX");
- else {
- va_start(ap, fmt);
- vfprintf(stdout, fmt, ap);
- va_end(ap);
- }
- }
- va_start(ap, fmt);
- sec_vfprintf(cout, fmt, ap);
- va_end(ap);
- if(debug){
- printf("\n");
- fflush(stdout);
- }
- fprintf (cout, "\r\n");
- fflush (cout);
- cpend = 1;
- r = getreply (!strcmp (fmt, "QUIT"));
- if (abrtflag && oldintr != SIG_IGN)
- (*oldintr) (SIGINT);
- signal (SIGINT, oldintr);
- return (r);
-}
-
-char reply_string[BUFSIZ]; /* last line of previous reply */
-
-int
-getreply (int expecteof)
-{
- char *p;
- char *lead_string;
- int c;
- struct sigaction sa, osa;
- char buf[8192];
- int reply_code;
- int long_warn = 0;
-
- sigemptyset (&sa.sa_mask);
- sa.sa_flags = 0;
- sa.sa_handler = cmdabort;
- sigaction (SIGINT, &sa, &osa);
-
- p = buf;
-
- reply_code = 0;
- while (1) {
- c = getc (cin);
- switch (c) {
- case EOF:
- if (expecteof) {
- sigaction (SIGINT, &osa, NULL);
- code = 221;
- return 0;
- }
- lostpeer (0);
- if (verbose) {
- printf ("421 Service not available, "
- "remote server has closed connection\n");
- fflush (stdout);
- }
- code = 421;
- return (4);
- case IAC:
- c = getc (cin);
- if (c == WILL || c == WONT)
- fprintf (cout, "%c%c%c", IAC, DONT, getc (cin));
- if (c == DO || c == DONT)
- fprintf (cout, "%c%c%c", IAC, WONT, getc (cin));
- continue;
- case '\n':
- *p++ = '\0';
- if(isdigit((unsigned char)buf[0])){
- sscanf(buf, "%d", &code);
- if(code == 631){
- code = 0;
- sec_read_msg(buf, prot_safe);
- sscanf(buf, "%d", &code);
- lead_string = "S:";
- } else if(code == 632){
- code = 0;
- sec_read_msg(buf, prot_private);
- sscanf(buf, "%d", &code);
- lead_string = "P:";
- }else if(code == 633){
- code = 0;
- sec_read_msg(buf, prot_confidential);
- sscanf(buf, "%d", &code);
- lead_string = "C:";
- }else if(sec_complete)
- lead_string = "!!";
- else
- lead_string = "";
- if(code != 0 && reply_code == 0)
- reply_code = code;
- if (verbose > 0 || (verbose > -1 && code > 499))
- fprintf (stdout, "%s%s\n", lead_string, buf);
- if (code == reply_code && buf[3] == ' ') {
- strlcpy (reply_string, buf, sizeof(reply_string));
- if (code >= 200)
- cpend = 0;
- sigaction (SIGINT, &osa, NULL);
- if (code == 421)
- lostpeer (0);
-#if 1
- if (abrtflag &&
- osa.sa_handler != cmdabort &&
- osa.sa_handler != SIG_IGN)
- osa.sa_handler (SIGINT);
-#endif
- if (code == 227 || code == 229) {
- char *q;
-
- q = strchr (reply_string, '(');
- if (q) {
- q++;
- strlcpy(pasv, q, sizeof(pasv));
- q = strrchr(pasv, ')');
- if (q)
- *q = '\0';
- }
- }
- return code / 100;
- }
- }else{
- if(verbose > 0 || (verbose > -1 && code > 499)){
- if(sec_complete)
- fprintf(stdout, "!!");
- fprintf(stdout, "%s\n", buf);
- }
- }
- p = buf;
- long_warn = 0;
- continue;
- default:
- if(p < buf + sizeof(buf) - 1)
- *p++ = c;
- else if(long_warn == 0) {
- fprintf(stderr, "WARNING: incredibly long line received\n");
- long_warn = 1;
- }
- }
- }
-
-}
-
-
-#if 0
-int
-getreply (int expecteof)
-{
- int c, n;
- int dig;
- int originalcode = 0, continuation = 0;
- sighand oldintr;
- int pflag = 0;
- char *cp, *pt = pasv;
-
- oldintr = signal (SIGINT, cmdabort);
- for (;;) {
- dig = n = code = 0;
- cp = reply_string;
- while ((c = getc (cin)) != '\n') {
- if (c == IAC) { /* handle telnet commands */
- switch (c = getc (cin)) {
- case WILL:
- case WONT:
- c = getc (cin);
- fprintf (cout, "%c%c%c", IAC, DONT, c);
- fflush (cout);
- break;
- case DO:
- case DONT:
- c = getc (cin);
- fprintf (cout, "%c%c%c", IAC, WONT, c);
- fflush (cout);
- break;
- default:
- break;
- }
- continue;
- }
- dig++;
- if (c == EOF) {
- if (expecteof) {
- signal (SIGINT, oldintr);
- code = 221;
- return (0);
- }
- lostpeer (0);
- if (verbose) {
- printf ("421 Service not available, remote server has closed connection\n");
- fflush (stdout);
- }
- code = 421;
- return (4);
- }
- if (c != '\r' && (verbose > 0 ||
- (verbose > -1 && n == '5' && dig > 4))) {
- if (proxflag &&
- (dig == 1 || dig == 5 && verbose == 0))
- printf ("%s:", hostname);
- putchar (c);
- }
- if (dig < 4 && isdigit (c))
- code = code * 10 + (c - '0');
- if (!pflag && code == 227)
- pflag = 1;
- if (dig > 4 && pflag == 1 && isdigit (c))
- pflag = 2;
- if (pflag == 2) {
- if (c != '\r' && c != ')')
- *pt++ = c;
- else {
- *pt = '\0';
- pflag = 3;
- }
- }
- if (dig == 4 && c == '-') {
- if (continuation)
- code = 0;
- continuation++;
- }
- if (n == 0)
- n = c;
- if (cp < &reply_string[sizeof (reply_string) - 1])
- *cp++ = c;
- }
- if (verbose > 0 || verbose > -1 && n == '5') {
- putchar (c);
- fflush (stdout);
- }
- if (continuation && code != originalcode) {
- if (originalcode == 0)
- originalcode = code;
- continue;
- }
- *cp = '\0';
- if(sec_complete){
- if(code == 631)
- sec_read_msg(reply_string, prot_safe);
- else if(code == 632)
- sec_read_msg(reply_string, prot_private);
- else if(code == 633)
- sec_read_msg(reply_string, prot_confidential);
- n = code / 100 + '0';
- }
- if (n != '1')
- cpend = 0;
- signal (SIGINT, oldintr);
- if (code == 421 || originalcode == 421)
- lostpeer (0);
- if (abrtflag && oldintr != cmdabort && oldintr != SIG_IGN)
- (*oldintr) (SIGINT);
- return (n - '0');
- }
-}
-
-#endif
-
-int
-empty (fd_set * mask, int sec)
-{
- struct timeval t;
-
- t.tv_sec = sec;
- t.tv_usec = 0;
- return (select (FD_SETSIZE, mask, NULL, NULL, &t));
-}
-
-jmp_buf sendabort;
-
-static RETSIGTYPE
-abortsend (int sig)
-{
-
- mflag = 0;
- abrtflag = 0;
- printf ("\nsend aborted\nwaiting for remote to finish abort\n");
- fflush (stdout);
- longjmp (sendabort, 1);
-}
-
-#define HASHBYTES 1024
-
-static int
-copy_stream (FILE * from, FILE * to)
-{
- static size_t bufsize;
- static char *buf;
- int n;
- int bytes = 0;
- int werr = 0;
- int hashbytes = HASHBYTES;
- struct stat st;
-
-#if defined(HAVE_MMAP) && !defined(NO_MMAP)
- void *chunk;
- size_t off;
-
-#define BLOCKSIZE (1024 * 1024 * 10)
-
-#ifndef MAP_FAILED
-#define MAP_FAILED (-1)
-#endif
-
- if (fstat (fileno (from), &st) == 0 && S_ISREG (st.st_mode)) {
- /*
- * mmap zero bytes has potential of loosing, don't do it.
- */
- if (st.st_size == 0)
- return 0;
- off = 0;
- while (off != st.st_size) {
- size_t len;
- ssize_t res;
-
- len = st.st_size - off;
- if (len > BLOCKSIZE)
- len = BLOCKSIZE;
-
- chunk = mmap (0, len, PROT_READ, MAP_SHARED, fileno (from), off);
- if (chunk == (void *) MAP_FAILED) {
- if (off == 0) /* try read if mmap doesn't work */
- goto try_read;
- break;
- }
-
- res = sec_write (fileno (to), chunk, len);
- if (msync (chunk, len, MS_ASYNC))
- warn ("msync");
- if (munmap (chunk, len) < 0)
- warn ("munmap");
- sec_fflush (to);
- if (res != len)
- return off;
- off += len;
- }
- return off;
- }
-try_read:
-#endif
-
- buf = alloc_buffer (buf, &bufsize,
- fstat (fileno (from), &st) >= 0 ? &st : NULL);
- if (buf == NULL)
- return -1;
-
- while ((n = read (fileno (from), buf, bufsize)) > 0) {
- werr = sec_write (fileno (to), buf, n);
- if (werr < 0)
- break;
- bytes += werr;
- while (hash && bytes > hashbytes) {
- putchar ('#');
- hashbytes += HASHBYTES;
- }
- }
- sec_fflush (to);
- if (n < 0)
- warn ("local");
-
- if (werr < 0) {
- if (errno != EPIPE)
- warn ("netout");
- bytes = -1;
- }
- return bytes;
-}
-
-void
-sendrequest (char *cmd, char *local, char *remote, char *lmode, int printnames)
-{
- struct stat st;
- struct timeval start, stop;
- int c, d;
- FILE *fin, *dout = 0;
- int (*closefunc) (FILE *);
- RETSIGTYPE (*oldintr)(int), (*oldintp)(int);
- long bytes = 0, hashbytes = HASHBYTES;
- char *rmode = "w";
-
- if (verbose && printnames) {
- if (strcmp (local, "-") != 0)
- printf ("local: %s ", local);
- if (remote)
- printf ("remote: %s\n", remote);
- }
- if (proxy) {
- proxtrans (cmd, local, remote);
- return;
- }
- if (curtype != type)
- changetype (type, 0);
- closefunc = NULL;
- oldintr = NULL;
- oldintp = NULL;
-
- if (setjmp (sendabort)) {
- while (cpend) {
- getreply (0);
- }
- if (data >= 0) {
- close (data);
- data = -1;
- }
- if (oldintr)
- signal (SIGINT, oldintr);
- if (oldintp)
- signal (SIGPIPE, oldintp);
- code = -1;
- return;
- }
- oldintr = signal (SIGINT, abortsend);
- if (strcmp (local, "-") == 0)
- fin = stdin;
- else if (*local == '|') {
- oldintp = signal (SIGPIPE, SIG_IGN);
- fin = popen (local + 1, lmode);
- if (fin == NULL) {
- warn ("%s", local + 1);
- signal (SIGINT, oldintr);
- signal (SIGPIPE, oldintp);
- code = -1;
- return;
- }
- closefunc = pclose;
- } else {
- fin = fopen (local, lmode);
- if (fin == NULL) {
- warn ("local: %s", local);
- signal (SIGINT, oldintr);
- code = -1;
- return;
- }
- closefunc = fclose;
- if (fstat (fileno (fin), &st) < 0 || !S_ISREG(st.st_mode)) {
- fprintf (stdout, "%s: not a plain file.\n", local);
- signal (SIGINT, oldintr);
- fclose (fin);
- code = -1;
- return;
- }
- }
- if (initconn ()) {
- signal (SIGINT, oldintr);
- if (oldintp)
- signal (SIGPIPE, oldintp);
- code = -1;
- if (closefunc != NULL)
- (*closefunc) (fin);
- return;
- }
- if (setjmp (sendabort))
- goto abort;
-
- if (restart_point &&
- (strcmp (cmd, "STOR") == 0 || strcmp (cmd, "APPE") == 0)) {
- int rc;
-
- switch (curtype) {
- case TYPE_A:
- rc = fseek (fin, (long) restart_point, SEEK_SET);
- break;
- case TYPE_I:
- case TYPE_L:
- rc = lseek (fileno (fin), restart_point, SEEK_SET);
- break;
- default:
- abort();
- }
- if (rc < 0) {
- warn ("local: %s", local);
- restart_point = 0;
- if (closefunc != NULL)
- (*closefunc) (fin);
- return;
- }
- if (command ("REST %ld", (long) restart_point)
- != CONTINUE) {
- restart_point = 0;
- if (closefunc != NULL)
- (*closefunc) (fin);
- return;
- }
- restart_point = 0;
- rmode = "r+w";
- }
- if (remote) {
- if (command ("%s %s", cmd, remote) != PRELIM) {
- signal (SIGINT, oldintr);
- if (oldintp)
- signal (SIGPIPE, oldintp);
- if (closefunc != NULL)
- (*closefunc) (fin);
- return;
- }
- } else if (command ("%s", cmd) != PRELIM) {
- signal(SIGINT, oldintr);
- if (oldintp)
- signal(SIGPIPE, oldintp);
- if (closefunc != NULL)
- (*closefunc)(fin);
- return;
- }
- dout = dataconn(rmode);
- if (dout == NULL)
- goto abort;
- set_buffer_size (fileno (dout), 0);
- gettimeofday (&start, (struct timezone *) 0);
- oldintp = signal (SIGPIPE, SIG_IGN);
- switch (curtype) {
-
- case TYPE_I:
- case TYPE_L:
- errno = d = c = 0;
- bytes = copy_stream (fin, dout);
- break;
-
- case TYPE_A:
- while ((c = getc (fin)) != EOF) {
- if (c == '\n') {
- while (hash && (bytes >= hashbytes)) {
- putchar ('#');
- fflush (stdout);
- hashbytes += HASHBYTES;
- }
- if (ferror (dout))
- break;
- sec_putc ('\r', dout);
- bytes++;
- }
- sec_putc (c, dout);
- bytes++;
- }
- sec_fflush (dout);
- if (hash) {
- if (bytes < hashbytes)
- putchar ('#');
- putchar ('\n');
- fflush (stdout);
- }
- if (ferror (fin))
- warn ("local: %s", local);
- if (ferror (dout)) {
- if (errno != EPIPE)
- warn ("netout");
- bytes = -1;
- }
- break;
- }
- if (closefunc != NULL)
- (*closefunc) (fin);
- fclose (dout);
- gettimeofday (&stop, (struct timezone *) 0);
- getreply (0);
- signal (SIGINT, oldintr);
- if (oldintp)
- signal (SIGPIPE, oldintp);
- if (bytes > 0)
- ptransfer ("sent", bytes, &start, &stop);
- return;
-abort:
- signal (SIGINT, oldintr);
- if (oldintp)
- signal (SIGPIPE, oldintp);
- if (!cpend) {
- code = -1;
- return;
- }
- if (data >= 0) {
- close (data);
- data = -1;
- }
- if (dout)
- fclose (dout);
- getreply (0);
- code = -1;
- if (closefunc != NULL && fin != NULL)
- (*closefunc) (fin);
- gettimeofday (&stop, (struct timezone *) 0);
- if (bytes > 0)
- ptransfer ("sent", bytes, &start, &stop);
-}
-
-jmp_buf recvabort;
-
-void
-abortrecv (int sig)
-{
-
- mflag = 0;
- abrtflag = 0;
- printf ("\nreceive aborted\nwaiting for remote to finish abort\n");
- fflush (stdout);
- longjmp (recvabort, 1);
-}
-
-void
-recvrequest (char *cmd, char *local, char *remote,
- char *lmode, int printnames, int local_given)
-{
- FILE *fout = NULL, *din = NULL;
- int (*closefunc) (FILE *);
- sighand oldintr, oldintp;
- int c, d, is_retr, tcrflag, bare_lfs = 0;
- static size_t bufsize;
- static char *buf;
- long bytes = 0, hashbytes = HASHBYTES;
- struct timeval start, stop;
- struct stat st;
-
- is_retr = strcmp (cmd, "RETR") == 0;
- if (is_retr && verbose && printnames) {
- if (strcmp (local, "-") != 0)
- printf ("local: %s ", local);
- if (remote)
- printf ("remote: %s\n", remote);
- }
- if (proxy && is_retr) {
- proxtrans (cmd, local, remote);
- return;
- }
- closefunc = NULL;
- oldintr = NULL;
- oldintp = NULL;
- tcrflag = !crflag && is_retr;
- if (setjmp (recvabort)) {
- while (cpend) {
- getreply (0);
- }
- if (data >= 0) {
- close (data);
- data = -1;
- }
- if (oldintr)
- signal (SIGINT, oldintr);
- code = -1;
- return;
- }
- oldintr = signal (SIGINT, abortrecv);
- if (!local_given || (strcmp(local, "-") && *local != '|')) {
- if (access (local, 2) < 0) {
- char *dir = strrchr (local, '/');
-
- if (errno != ENOENT && errno != EACCES) {
- warn ("local: %s", local);
- signal (SIGINT, oldintr);
- code = -1;
- return;
- }
- if (dir != NULL)
- *dir = 0;
- d = access (dir ? local : ".", 2);
- if (dir != NULL)
- *dir = '/';
- if (d < 0) {
- warn ("local: %s", local);
- signal (SIGINT, oldintr);
- code = -1;
- return;
- }
- if (!runique && errno == EACCES &&
- chmod (local, 0600) < 0) {
- warn ("local: %s", local);
- signal (SIGINT, oldintr);
- signal (SIGINT, oldintr);
- code = -1;
- return;
- }
- if (runique && errno == EACCES &&
- (local = gunique (local)) == NULL) {
- signal (SIGINT, oldintr);
- code = -1;
- return;
- }
- } else if (runique && (local = gunique (local)) == NULL) {
- signal(SIGINT, oldintr);
- code = -1;
- return;
- }
- }
- if (!is_retr) {
- if (curtype != TYPE_A)
- changetype (TYPE_A, 0);
- } else if (curtype != type)
- changetype (type, 0);
- if (initconn ()) {
- signal (SIGINT, oldintr);
- code = -1;
- return;
- }
- if (setjmp (recvabort))
- goto abort;
- if (is_retr && restart_point &&
- command ("REST %ld", (long) restart_point) != CONTINUE)
- return;
- if (remote) {
- if (command ("%s %s", cmd, remote) != PRELIM) {
- signal (SIGINT, oldintr);
- return;
- }
- } else {
- if (command ("%s", cmd) != PRELIM) {
- signal (SIGINT, oldintr);
- return;
- }
- }
- din = dataconn ("r");
- if (din == NULL)
- goto abort;
- set_buffer_size (fileno (din), 1);
- if (local_given && strcmp (local, "-") == 0)
- fout = stdout;
- else if (local_given && *local == '|') {
- oldintp = signal (SIGPIPE, SIG_IGN);
- fout = popen (local + 1, "w");
- if (fout == NULL) {
- warn ("%s", local + 1);
- goto abort;
- }
- closefunc = pclose;
- } else {
- fout = fopen (local, lmode);
- if (fout == NULL) {
- warn ("local: %s", local);
- goto abort;
- }
- closefunc = fclose;
- }
- buf = alloc_buffer (buf, &bufsize,
- fstat (fileno (fout), &st) >= 0 ? &st : NULL);
- if (buf == NULL)
- goto abort;
-
- gettimeofday (&start, (struct timezone *) 0);
- switch (curtype) {
-
- case TYPE_I:
- case TYPE_L:
- if (restart_point &&
- lseek (fileno (fout), restart_point, SEEK_SET) < 0) {
- warn ("local: %s", local);
- if (closefunc != NULL)
- (*closefunc) (fout);
- return;
- }
- errno = d = 0;
- while ((c = sec_read (fileno (din), buf, bufsize)) > 0) {
- if ((d = write (fileno (fout), buf, c)) != c)
- break;
- bytes += c;
- if (hash) {
- while (bytes >= hashbytes) {
- putchar ('#');
- hashbytes += HASHBYTES;
- }
- fflush (stdout);
- }
- }
- if (hash && bytes > 0) {
- if (bytes < HASHBYTES)
- putchar ('#');
- putchar ('\n');
- fflush (stdout);
- }
- if (c < 0) {
- if (errno != EPIPE)
- warn ("netin");
- bytes = -1;
- }
- if (d < c) {
- if (d < 0)
- warn ("local: %s", local);
- else
- warnx ("%s: short write", local);
- }
- break;
-
- case TYPE_A:
- if (restart_point) {
- int i, n, ch;
-
- if (fseek (fout, 0L, SEEK_SET) < 0)
- goto done;
- n = restart_point;
- for (i = 0; i++ < n;) {
- if ((ch = sec_getc (fout)) == EOF)
- goto done;
- if (ch == '\n')
- i++;
- }
- if (fseek (fout, 0L, SEEK_CUR) < 0) {
- done:
- warn ("local: %s", local);
- if (closefunc != NULL)
- (*closefunc) (fout);
- return;
- }
- }
- while ((c = sec_getc(din)) != EOF) {
- if (c == '\n')
- bare_lfs++;
- while (c == '\r') {
- while (hash && (bytes >= hashbytes)) {
- putchar ('#');
- fflush (stdout);
- hashbytes += HASHBYTES;
- }
- bytes++;
- if ((c = sec_getc (din)) != '\n' || tcrflag) {
- if (ferror (fout))
- goto break2;
- putc ('\r', fout);
- if (c == '\0') {
- bytes++;
- goto contin2;
- }
- if (c == EOF)
- goto contin2;
- }
- }
- putc (c, fout);
- bytes++;
- contin2:;
- }
-break2:
- if (bare_lfs) {
- printf ("WARNING! %d bare linefeeds received in ASCII mode\n",
- bare_lfs);
- printf ("File may not have transferred correctly.\n");
- }
- if (hash) {
- if (bytes < hashbytes)
- putchar ('#');
- putchar ('\n');
- fflush (stdout);
- }
- if (ferror (din)) {
- if (errno != EPIPE)
- warn ("netin");
- bytes = -1;
- }
- if (ferror (fout))
- warn ("local: %s", local);
- break;
- }
- if (closefunc != NULL)
- (*closefunc) (fout);
- signal (SIGINT, oldintr);
- if (oldintp)
- signal (SIGPIPE, oldintp);
- fclose (din);
- gettimeofday (&stop, (struct timezone *) 0);
- getreply (0);
- if (bytes > 0 && is_retr)
- ptransfer ("received", bytes, &start, &stop);
- return;
-abort:
-
- /* abort using RFC959 recommended IP,SYNC sequence */
-
- if (oldintp)
- signal (SIGPIPE, oldintr);
- signal (SIGINT, SIG_IGN);
- if (!cpend) {
- code = -1;
- signal (SIGINT, oldintr);
- return;
- }
- abort_remote(din);
- code = -1;
- if (data >= 0) {
- close (data);
- data = -1;
- }
- if (closefunc != NULL && fout != NULL)
- (*closefunc) (fout);
- if (din)
- fclose (din);
- gettimeofday (&stop, (struct timezone *) 0);
- if (bytes > 0)
- ptransfer ("received", bytes, &start, &stop);
- signal (SIGINT, oldintr);
-}
-
-static int
-parse_epsv (const char *str)
-{
- char sep;
- char *end;
- int port;
-
- if (*str == '\0')
- return -1;
- sep = *str++;
- if (sep != *str++)
- return -1;
- if (sep != *str++)
- return -1;
- port = strtol (str, &end, 0);
- if (str == end)
- return -1;
- if (end[0] != sep || end[1] != '\0')
- return -1;
- return htons(port);
-}
-
-static int
-parse_pasv (struct sockaddr_in *sin4, const char *str)
-{
- int a0, a1, a2, a3, p0, p1;
-
- /*
- * What we've got at this point is a string of comma separated
- * one-byte unsigned integer values. The first four are the an IP
- * address. The fifth is the MSB of the port number, the sixth is the
- * LSB. From that we'll prepare a sockaddr_in.
- */
-
- if (sscanf (str, "%d,%d,%d,%d,%d,%d",
- &a0, &a1, &a2, &a3, &p0, &p1) != 6) {
- printf ("Passive mode address scan failure. "
- "Shouldn't happen!\n");
- return -1;
- }
- if (a0 < 0 || a0 > 255 ||
- a1 < 0 || a1 > 255 ||
- a2 < 0 || a2 > 255 ||
- a3 < 0 || a3 > 255 ||
- p0 < 0 || p0 > 255 ||
- p1 < 0 || p1 > 255) {
- printf ("Can't parse passive mode string.\n");
- return -1;
- }
- memset (sin4, 0, sizeof(*sin4));
- sin4->sin_family = AF_INET;
- sin4->sin_addr.s_addr = htonl ((a0 << 24) | (a1 << 16) |
- (a2 << 8) | a3);
- sin4->sin_port = htons ((p0 << 8) | p1);
- return 0;
-}
-
-static int
-passive_mode (void)
-{
- int port;
-
- data = socket (myctladdr->sa_family, SOCK_STREAM, 0);
- if (data < 0) {
- warn ("socket");
- return (1);
- }
- if (options & SO_DEBUG)
- socket_set_debug (data);
- if (command ("EPSV") != COMPLETE) {
- if (command ("PASV") != COMPLETE) {
- printf ("Passive mode refused.\n");
- goto bad;
- }
- }
-
- /*
- * Parse the reply to EPSV or PASV
- */
-
- port = parse_epsv (pasv);
- if (port > 0) {
- data_addr->sa_family = myctladdr->sa_family;
- socket_set_address_and_port (data_addr,
- socket_get_address (hisctladdr),
- port);
- } else {
- if (parse_pasv ((struct sockaddr_in *)data_addr, pasv) < 0)
- goto bad;
- }
-
- if (connect (data, data_addr, socket_sockaddr_size (data_addr)) < 0) {
- warn ("connect");
- goto bad;
- }
-#ifdef IPTOS_THROUGHPUT
- socket_set_tos (data, IPTOS_THROUGHPUT);
-#endif
- return (0);
-bad:
- close (data);
- data = -1;
- sendport = 1;
- return (1);
-}
-
-
-static int
-active_mode (void)
-{
- int tmpno = 0;
- socklen_t len;
- int result;
-
-noport:
- data_addr->sa_family = myctladdr->sa_family;
- socket_set_address_and_port (data_addr, socket_get_address (myctladdr),
- sendport ? 0 : socket_get_port (myctladdr));
-
- if (data != -1)
- close (data);
- data = socket (data_addr->sa_family, SOCK_STREAM, 0);
- if (data < 0) {
- warn ("socket");
- if (tmpno)
- sendport = 1;
- return (1);
- }
- if (!sendport)
- socket_set_reuseaddr (data, 1);
- if (bind (data, data_addr, socket_sockaddr_size (data_addr)) < 0) {
- warn ("bind");
- goto bad;
- }
- if (options & SO_DEBUG)
- socket_set_debug (data);
- len = sizeof (data_addr_ss);
- if (getsockname (data, data_addr, &len) < 0) {
- warn ("getsockname");
- goto bad;
- }
- if (listen (data, 1) < 0)
- warn ("listen");
- if (sendport) {
- char addr_str[256];
- int inet_af;
- int overbose;
-
- if (inet_ntop (data_addr->sa_family, socket_get_address (data_addr),
- addr_str, sizeof(addr_str)) == NULL)
- errx (1, "inet_ntop failed");
- switch (data_addr->sa_family) {
- case AF_INET :
- inet_af = 1;
- break;
-#ifdef HAVE_IPV6
- case AF_INET6 :
- inet_af = 2;
- break;
-#endif
- default :
- errx (1, "bad address family %d", data_addr->sa_family);
- }
-
-
- overbose = verbose;
- if (debug == 0)
- verbose = -1;
-
- result = command ("EPRT |%d|%s|%d|",
- inet_af, addr_str,
- ntohs(socket_get_port (data_addr)));
- verbose = overbose;
-
- if (result == ERROR) {
- struct sockaddr_in *sin4 = (struct sockaddr_in *)data_addr;
-
- unsigned int a = ntohl(sin4->sin_addr.s_addr);
- unsigned int p = ntohs(sin4->sin_port);
-
- if (data_addr->sa_family != AF_INET) {
- warnx ("remote server doesn't support EPRT");
- goto bad;
- }
-
- result = command("PORT %d,%d,%d,%d,%d,%d",
- (a >> 24) & 0xff,
- (a >> 16) & 0xff,
- (a >> 8) & 0xff,
- a & 0xff,
- (p >> 8) & 0xff,
- p & 0xff);
- if (result == ERROR && sendport == -1) {
- sendport = 0;
- tmpno = 1;
- goto noport;
- }
- return (result != COMPLETE);
- }
- return result != COMPLETE;
- }
- if (tmpno)
- sendport = 1;
-
-
-#ifdef IPTOS_THROUGHPUT
- socket_set_tos (data, IPTOS_THROUGHPUT);
-#endif
- return (0);
-bad:
- close (data);
- data = -1;
- if (tmpno)
- sendport = 1;
- return (1);
-}
-
-/*
- * Need to start a listen on the data channel before we send the command,
- * otherwise the server's connect may fail.
- */
-int
-initconn (void)
-{
- if (passivemode)
- return passive_mode ();
- else
- return active_mode ();
-}
-
-FILE *
-dataconn (const char *lmode)
-{
- struct sockaddr_storage from_ss;
- struct sockaddr *from = (struct sockaddr *)&from_ss;
- socklen_t fromlen = sizeof(from_ss);
- int s;
-
- if (passivemode)
- return (fdopen (data, lmode));
-
- s = accept (data, from, &fromlen);
- if (s < 0) {
- warn ("accept");
- close (data), data = -1;
- return (NULL);
- }
- close (data);
- data = s;
-#ifdef IPTOS_THROUGHPUT
- socket_set_tos (s, IPTOS_THROUGHPUT);
-#endif
- return (fdopen (data, lmode));
-}
-
-void
-ptransfer (char *direction, long int bytes,
- struct timeval * t0, struct timeval * t1)
-{
- struct timeval td;
- float s;
- float bs;
- int prec;
- char *unit;
-
- if (verbose) {
- td.tv_sec = t1->tv_sec - t0->tv_sec;
- td.tv_usec = t1->tv_usec - t0->tv_usec;
- if (td.tv_usec < 0) {
- td.tv_sec--;
- td.tv_usec += 1000000;
- }
- s = td.tv_sec + (td.tv_usec / 1000000.);
- bs = bytes / (s ? s : 1);
- if (bs >= 1048576) {
- bs /= 1048576;
- unit = "M";
- prec = 2;
- } else if (bs >= 1024) {
- bs /= 1024;
- unit = "k";
- prec = 1;
- } else {
- unit = "";
- prec = 0;
- }
-
- printf ("%ld bytes %s in %.3g seconds (%.*f %sbyte/s)\n",
- bytes, direction, s, prec, bs, unit);
- }
-}
-
-void
-psabort (int sig)
-{
-
- abrtflag++;
-}
-
-void
-pswitch (int flag)
-{
- sighand oldintr;
- static struct comvars {
- int connect;
- char name[MaxHostNameLen];
- struct sockaddr_storage mctl;
- struct sockaddr_storage hctl;
- FILE *in;
- FILE *out;
- int tpe;
- int curtpe;
- int cpnd;
- int sunqe;
- int runqe;
- int mcse;
- int ntflg;
- char nti[17];
- char nto[17];
- int mapflg;
- char mi[MaxPathLen];
- char mo[MaxPathLen];
- } proxstruct, tmpstruct;
- struct comvars *ip, *op;
-
- abrtflag = 0;
- oldintr = signal (SIGINT, psabort);
- if (flag) {
- if (proxy)
- return;
- ip = &tmpstruct;
- op = &proxstruct;
- proxy++;
- } else {
- if (!proxy)
- return;
- ip = &proxstruct;
- op = &tmpstruct;
- proxy = 0;
- }
- ip->connect = connected;
- connected = op->connect;
- if (hostname) {
- strlcpy (ip->name, hostname, sizeof (ip->name));
- } else
- ip->name[0] = 0;
- hostname = op->name;
- ip->hctl = hisctladdr_ss;
- hisctladdr_ss = op->hctl;
- ip->mctl = myctladdr_ss;
- myctladdr_ss = op->mctl;
- ip->in = cin;
- cin = op->in;
- ip->out = cout;
- cout = op->out;
- ip->tpe = type;
- type = op->tpe;
- ip->curtpe = curtype;
- curtype = op->curtpe;
- ip->cpnd = cpend;
- cpend = op->cpnd;
- ip->sunqe = sunique;
- sunique = op->sunqe;
- ip->runqe = runique;
- runique = op->runqe;
- ip->mcse = mcase;
- mcase = op->mcse;
- ip->ntflg = ntflag;
- ntflag = op->ntflg;
- strlcpy (ip->nti, ntin, sizeof (ip->nti));
- strlcpy (ntin, op->nti, 17);
- strlcpy (ip->nto, ntout, sizeof (ip->nto));
- strlcpy (ntout, op->nto, 17);
- ip->mapflg = mapflag;
- mapflag = op->mapflg;
- strlcpy (ip->mi, mapin, MaxPathLen);
- strlcpy (mapin, op->mi, MaxPathLen);
- strlcpy (ip->mo, mapout, MaxPathLen);
- strlcpy (mapout, op->mo, MaxPathLen);
- signal(SIGINT, oldintr);
- if (abrtflag) {
- abrtflag = 0;
- (*oldintr) (SIGINT);
- }
-}
-
-void
-abortpt (int sig)
-{
-
- printf ("\n");
- fflush (stdout);
- ptabflg++;
- mflag = 0;
- abrtflag = 0;
- longjmp (ptabort, 1);
-}
-
-void
-proxtrans (char *cmd, char *local, char *remote)
-{
- sighand oldintr = NULL;
- int secndflag = 0, prox_type, nfnd;
- char *cmd2;
- fd_set mask;
-
- if (strcmp (cmd, "RETR"))
- cmd2 = "RETR";
- else
- cmd2 = runique ? "STOU" : "STOR";
- if ((prox_type = type) == 0) {
- if (unix_server && unix_proxy)
- prox_type = TYPE_I;
- else
- prox_type = TYPE_A;
- }
- if (curtype != prox_type)
- changetype (prox_type, 1);
- if (command ("PASV") != COMPLETE) {
- printf ("proxy server does not support third party transfers.\n");
- return;
- }
- pswitch (0);
- if (!connected) {
- printf ("No primary connection\n");
- pswitch (1);
- code = -1;
- return;
- }
- if (curtype != prox_type)
- changetype (prox_type, 1);
- if (command ("PORT %s", pasv) != COMPLETE) {
- pswitch (1);
- return;
- }
- if (setjmp (ptabort))
- goto abort;
- oldintr = signal (SIGINT, abortpt);
- if (command ("%s %s", cmd, remote) != PRELIM) {
- signal (SIGINT, oldintr);
- pswitch (1);
- return;
- }
- sleep (2);
- pswitch (1);
- secndflag++;
- if (command ("%s %s", cmd2, local) != PRELIM)
- goto abort;
- ptflag++;
- getreply (0);
- pswitch (0);
- getreply (0);
- signal (SIGINT, oldintr);
- pswitch (1);
- ptflag = 0;
- printf ("local: %s remote: %s\n", local, remote);
- return;
-abort:
- signal (SIGINT, SIG_IGN);
- ptflag = 0;
- if (strcmp (cmd, "RETR") && !proxy)
- pswitch (1);
- else if (!strcmp (cmd, "RETR") && proxy)
- pswitch (0);
- if (!cpend && !secndflag) { /* only here if cmd = "STOR" (proxy=1) */
- if (command ("%s %s", cmd2, local) != PRELIM) {
- pswitch (0);
- if (cpend)
- abort_remote ((FILE *) NULL);
- }
- pswitch (1);
- if (ptabflg)
- code = -1;
- if (oldintr)
- signal (SIGINT, oldintr);
- return;
- }
- if (cpend)
- abort_remote ((FILE *) NULL);
- pswitch (!proxy);
- if (!cpend && !secndflag) { /* only if cmd = "RETR" (proxy=1) */
- if (command ("%s %s", cmd2, local) != PRELIM) {
- pswitch (0);
- if (cpend)
- abort_remote ((FILE *) NULL);
- pswitch (1);
- if (ptabflg)
- code = -1;
- signal (SIGINT, oldintr);
- return;
- }
- }
- if (cpend)
- abort_remote ((FILE *) NULL);
- pswitch (!proxy);
- if (cpend) {
- FD_ZERO (&mask);
- if (fileno(cin) >= FD_SETSIZE)
- errx (1, "fd too large");
- FD_SET (fileno (cin), &mask);
- if ((nfnd = empty (&mask, 10)) <= 0) {
- if (nfnd < 0) {
- warn ("abort");
- }
- if (ptabflg)
- code = -1;
- lostpeer (0);
- }
- getreply (0);
- getreply (0);
- }
- if (proxy)
- pswitch (0);
- pswitch (1);
- if (ptabflg)
- code = -1;
- signal (SIGINT, oldintr);
-}
-
-void
-reset (int argc, char **argv)
-{
- fd_set mask;
- int nfnd = 1;
-
- FD_ZERO (&mask);
- while (nfnd > 0) {
- if (fileno (cin) >= FD_SETSIZE)
- errx (1, "fd too large");
- FD_SET (fileno (cin), &mask);
- if ((nfnd = empty (&mask, 0)) < 0) {
- warn ("reset");
- code = -1;
- lostpeer(0);
- } else if (nfnd) {
- getreply(0);
- }
- }
-}
-
-char *
-gunique (char *local)
-{
- static char new[MaxPathLen];
- char *cp = strrchr (local, '/');
- int d, count = 0;
- char ext = '1';
-
- if (cp)
- *cp = '\0';
- d = access (cp ? local : ".", 2);
- if (cp)
- *cp = '/';
- if (d < 0) {
- warn ("local: %s", local);
- return NULL;
- }
- strlcpy (new, local, sizeof(new));
- cp = new + strlen(new);
- *cp++ = '.';
- while (!d) {
- if (++count == 100) {
- printf ("runique: can't find unique file name.\n");
- return NULL;
- }
- *cp++ = ext;
- *cp = '\0';
- if (ext == '9')
- ext = '0';
- else
- ext++;
- if ((d = access (new, 0)) < 0)
- break;
- if (ext != '0')
- cp--;
- else if (*(cp - 2) == '.')
- *(cp - 1) = '1';
- else {
- *(cp - 2) = *(cp - 2) + 1;
- cp--;
- }
- }
- return (new);
-}
-
-void
-abort_remote (FILE * din)
-{
- char buf[BUFSIZ];
- int nfnd;
- fd_set mask;
-
- /*
- * send IAC in urgent mode instead of DM because 4.3BSD places oob mark
- * after urgent byte rather than before as is protocol now
- */
- snprintf (buf, sizeof (buf), "%c%c%c", IAC, IP, IAC);
- if (send (fileno (cout), buf, 3, MSG_OOB) != 3)
- warn ("abort");
- fprintf (cout, "%c", DM);
- sec_fprintf(cout, "ABOR");
- sec_fflush (cout);
- fprintf (cout, "\r\n");
- fflush(cout);
- FD_ZERO (&mask);
- if (fileno (cin) >= FD_SETSIZE)
- errx (1, "fd too large");
- FD_SET (fileno (cin), &mask);
- if (din) {
- if (fileno (din) >= FD_SETSIZE)
- errx (1, "fd too large");
- FD_SET (fileno (din), &mask);
- }
- if ((nfnd = empty (&mask, 10)) <= 0) {
- if (nfnd < 0) {
- warn ("abort");
- }
- if (ptabflg)
- code = -1;
- lostpeer (0);
- }
- if (din && FD_ISSET (fileno (din), &mask)) {
- while (read (fileno (din), buf, BUFSIZ) > 0)
- /* LOOP */ ;
- }
- if (getreply (0) == ERROR && code == 552) {
- /* 552 needed for nic style abort */
- getreply (0);
- }
- getreply (0);
-}
diff --git a/appl/ftp/ftp/ftp.cat1 b/appl/ftp/ftp/ftp.cat1
deleted file mode 100644
index f36c0da359de..000000000000
--- a/appl/ftp/ftp/ftp.cat1
+++ /dev/null
@@ -1,658 +0,0 @@
-
-FTP(1) BSD General Commands Manual FTP(1)
-
-NNAAMMEE
- ffttpp -- ARPANET file transfer program
-
-SSYYNNOOPPSSIISS
- ffttpp [--KK] [--dd] [--gg] [--ii] [--ll] [--nn] [--pp] [--tt] [--vv] [--xx] [----nnoo--ggssss--bbiinnddiinnggss]
- [----nnoo--ggssss--ddeelleeggaattee] [_h_o_s_t]
-
-DDEESSCCRRIIPPTTIIOONN
- ffttpp is the user interface to the ARPANET standard File Transfer Protocol.
- The program allows a user to transfer files to and from a remote network
- site.
-
- Modifications have been made so that it almost follows the FTP Security
- Extensions, RFC 2228.
-
- Options may be specified at the command line, or to the command inter-
- preter.
-
- --KK Disable Kerberos authentication.
-
- --tt Enables packet tracing.
-
- --vv Verbose option forces ffttpp to show all responses from the remote
- server, as well as report on data transfer statistics.
-
- --nn Restrains ffttpp from attempting ``auto-login'' upon initial connec-
- tion. If auto-login is enabled, ffttpp will check the _._n_e_t_r_c (see
- below) file in the user's home directory for an entry describing an
- account on the remote machine. If no entry exists, ffttpp will prompt
- for the remote machine login name (default is the user identity on
- the local machine), and, if necessary, prompt for a password and an
- account with which to login.
-
- --ii Turns off interactive prompting during multiple file transfers.
-
- --pp Turn on passive mode.
-
- --dd Enables debugging.
-
- --gg Disables file name globbing.
- .It Fl Fl no-gss-bindings Don't use GSS-API bindings when talking
- to peer. IP addresses will not be checked to ensure they match.
-
- ----nnoo--ggssss--ddeelleeggaattee
- Disable delegation of GSSAPI credentials.
-
- --ll Disables command line editing.
-
- --xx Encrypt command and data channel.
-
- The client host with which ffttpp is to communicate may be specified on the
- command line. If this is done, ffttpp will immediately attempt to establish
- a connection to an FTP server on that host; otherwise, ffttpp will enter its
- command interpreter and await instructions from the user. When ffttpp is
- awaiting commands from the user the prompt `ftp>' is provided to the
- user. The following commands are recognized by ffttpp:
-
- !! [_c_o_m_m_a_n_d [_a_r_g_s]]
- Invoke an interactive shell on the local machine. If there
- are arguments, the first is taken to be a command to execute
- directly, with the rest of the arguments as its arguments.
-
- $$ _m_a_c_r_o_-_n_a_m_e [_a_r_g_s]
- Execute the macro _m_a_c_r_o_-_n_a_m_e that was defined with the mmaaccddeeff
- command. Arguments are passed to the macro unglobbed.
-
- aaccccoouunntt [_p_a_s_s_w_d]
- Supply a supplemental password required by a remote system
- for access to resources once a login has been successfully
- completed. If no argument is included, the user will be
- prompted for an account password in a non-echoing input mode.
-
- aappppeenndd _l_o_c_a_l_-_f_i_l_e [_r_e_m_o_t_e_-_f_i_l_e]
- Append a local file to a file on the remote machine. If
- _r_e_m_o_t_e_-_f_i_l_e is left unspecified, the local file name is used
- in naming the remote file after being altered by any nnttrraannss
- or nnmmaapp setting. File transfer uses the current settings for
- ttyyppee, ffoorrmmaatt, mmooddee, and ssttrruuccttuurree.
-
- aasscciiii Set the file transfer ttyyppee to network ASCII. This is the
- default type.
-
- bbeellll Arrange that a bell be sounded after each file transfer com-
- mand is completed.
-
- bbiinnaarryy Set the file transfer ttyyppee to support binary image transfer.
-
- bbyyee Terminate the FTP session with the remote server and exit
- ffttpp. An end of file will also terminate the session and
- exit.
-
- ccaassee Toggle remote computer file name case mapping during mmggeett
- commands. When ccaassee is on (default is off), remote computer
- file names with all letters in upper case are written in the
- local directory with the letters mapped to lower case.
-
- ccdd _r_e_m_o_t_e_-_d_i_r_e_c_t_o_r_y
- Change the working directory on the remote machine to
- _r_e_m_o_t_e_-_d_i_r_e_c_t_o_r_y.
-
- ccdduupp Change the remote machine working directory to the parent of
- the current remote machine working directory.
-
- cchhmmoodd _m_o_d_e _f_i_l_e_-_n_a_m_e
- Change the permission modes of the file _f_i_l_e_-_n_a_m_e on the
- remote sytem to _m_o_d_e.
-
- cclloossee Terminate the FTP session with the remote server, and return
- to the command interpreter. Any defined macros are erased.
-
- ccrr Toggle carriage return stripping during ascii type file
- retrieval. Records are denoted by a carriage return/linefeed
- sequence during ascii type file transfer. When ccrr is on (the
- default), carriage returns are stripped from this sequence to
- conform with the UNIX single linefeed record delimiter.
- Records on non-UNIX remote systems may contain single line-
- feeds; when an ascii type transfer is made, these linefeeds
- may be distinguished from a record delimiter only when ccrr is
- off.
-
- ddeelleettee _r_e_m_o_t_e_-_f_i_l_e
- Delete the file _r_e_m_o_t_e_-_f_i_l_e on the remote machine.
-
- ddeebbuugg [_d_e_b_u_g_-_v_a_l_u_e]
- Toggle debugging mode. If an optional _d_e_b_u_g_-_v_a_l_u_e is speci-
- fied it is used to set the debugging level. When debugging
- is on, ffttpp prints each command sent to the remote machine,
- preceded by the string `-->'
-
- ddiirr [_r_e_m_o_t_e_-_d_i_r_e_c_t_o_r_y] [_l_o_c_a_l_-_f_i_l_e]
- Print a listing of the directory contents in the directory,
- _r_e_m_o_t_e_-_d_i_r_e_c_t_o_r_y, and, optionally, placing the output in
- _l_o_c_a_l_-_f_i_l_e. If interactive prompting is on, ffttpp will prompt
- the user to verify that the last argument is indeed the tar-
- get local file for receiving ddiirr output. If no directory is
- specified, the current working directory on the remote
- machine is used. If no local file is specified, or
- _l_o_c_a_l_-_f_i_l_e is --, output comes to the terminal.
-
- ddiissccoonnnneecctt A synonym for _c_l_o_s_e.
-
- ffoorrmm _f_o_r_m_a_t
- Set the file transfer ffoorrmm to _f_o_r_m_a_t. The default format is
- ``file''.
-
- ggeett _r_e_m_o_t_e_-_f_i_l_e [_l_o_c_a_l_-_f_i_l_e]
- Retrieve the _r_e_m_o_t_e_-_f_i_l_e and store it on the local machine.
- If the local file name is not specified, it is given the same
- name it has on the remote machine, subject to alteration by
- the current ccaassee, nnttrraannss, and nnmmaapp settings. The current
- settings for ttyyppee, ffoorrmm, mmooddee, and ssttrruuccttuurree are used while
- transferring the file.
-
- gglloobb Toggle filename expansion for mmddeelleettee, mmggeett and mmppuutt. If
- globbing is turned off with gglloobb, the file name arguments are
- taken literally and not expanded. Globbing for mmppuutt is done
- as in csh(1). For mmddeelleettee and mmggeett, each remote file name is
- expanded separately on the remote machine and the lists are
- not merged. Expansion of a directory name is likely to be
- different from expansion of the name of an ordinary file: the
- exact result depends on the foreign operating system and ftp
- server, and can be previewed by doing `mls remote-files -'.
- As a security measure, remotely globbed files that starts
- with `/' or contains `../', will not be automatically
- received. If you have interactive prompting turned off, these
- filenames will be ignored. Note: mmggeett and mmppuutt are not meant
- to transfer entire directory subtrees of files. That can be
- done by transferring a tar(1) archive of the subtree (in
- binary mode).
-
- hhaasshh Toggle hash-sign (``#'') printing for each data block trans-
- ferred. The size of a data block is 1024 bytes.
-
- hheellpp [_c_o_m_m_a_n_d]
- Print an informative message about the meaning of _c_o_m_m_a_n_d.
- If no argument is given, ffttpp prints a list of the known com-
- mands.
-
- iiddllee [_s_e_c_o_n_d_s]
- Set the inactivity timer on the remote server to _s_e_c_o_n_d_s sec-
- onds. If _s_e_c_o_n_d_s is omitted, the current inactivity timer is
- printed.
-
- llccdd [_d_i_r_e_c_t_o_r_y]
- Change the working directory on the local machine. If no
- _d_i_r_e_c_t_o_r_y is specified, the user's home directory is used.
-
- llss [_r_e_m_o_t_e_-_d_i_r_e_c_t_o_r_y] [_l_o_c_a_l_-_f_i_l_e]
- Print a listing of the contents of a directory on the remote
- machine. The listing includes any system-dependent informa-
- tion that the server chooses to include; for example, most
- UNIX systems will produce output from the command `ls -l'.
- (See also nnlliisstt.) If _r_e_m_o_t_e_-_d_i_r_e_c_t_o_r_y is left unspecified,
- the current working directory is used. If interactive
- prompting is on, ffttpp will prompt the user to verify that the
- last argument is indeed the target local file for receiving
- llss output. If no local file is specified, or if _l_o_c_a_l_-_f_i_l_e
- is `--', the output is sent to the terminal.
-
- mmaaccddeeff _m_a_c_r_o_-_n_a_m_e
- Define a macro. Subsequent lines are stored as the macro
- _m_a_c_r_o_-_n_a_m_e; a null line (consecutive newline characters in a
- file or carriage returns from the terminal) terminates macro
- input mode. There is a limit of 16 macros and 4096 total
- characters in all defined macros. Macros remain defined
- until a cclloossee command is executed. The macro processor
- interprets `$' and `\' as special characters. A `$' followed
- by a number (or numbers) is replaced by the corresponding
- argument on the macro invocation command line. A `$' fol-
- lowed by an `i' signals that macro processor that the execut-
- ing macro is to be looped. On the first pass `$i' is
- replaced by the first argument on the macro invocation com-
- mand line, on the second pass it is replaced by the second
- argument, and so on. A `\' followed by any character is
- replaced by that character. Use the `\' to prevent special
- treatment of the `$'.
-
- mmddeelleettee [_r_e_m_o_t_e_-_f_i_l_e_s]
- Delete the _r_e_m_o_t_e_-_f_i_l_e_s on the remote machine.
-
- mmddiirr _r_e_m_o_t_e_-_f_i_l_e_s _l_o_c_a_l_-_f_i_l_e
- Like ddiirr, except multiple remote files may be specified. If
- interactive prompting is on, ffttpp will prompt the user to ver-
- ify that the last argument is indeed the target local file
- for receiving mmddiirr output.
-
- mmggeett _r_e_m_o_t_e_-_f_i_l_e_s
- Expand the _r_e_m_o_t_e_-_f_i_l_e_s on the remote machine and do a ggeett
- for each file name thus produced. See gglloobb for details on
- the filename expansion. Resulting file names will then be
- processed according to ccaassee, nnttrraannss, and nnmmaapp settings.
- Files are transferred into the local working directory, which
- can be changed with `lcd directory'; new local directories
- can be created with `! mkdir directory'.
-
- mmkkddiirr _d_i_r_e_c_t_o_r_y_-_n_a_m_e
- Make a directory on the remote machine.
-
- mmllss _r_e_m_o_t_e_-_f_i_l_e_s _l_o_c_a_l_-_f_i_l_e
- Like nnlliisstt, except multiple remote files may be specified,
- and the _l_o_c_a_l_-_f_i_l_e must be specified. If interactive prompt-
- ing is on, ffttpp will prompt the user to verify that the last
- argument is indeed the target local file for receiving mmllss
- output.
-
- mmooddee [_m_o_d_e_-_n_a_m_e]
- Set the file transfer mmooddee to _m_o_d_e_-_n_a_m_e. The default mode is
- ``stream'' mode.
-
- mmooddttiimmee _f_i_l_e_-_n_a_m_e
- Show the last modification time of the file on the remote
- machine.
-
- mmppuutt _l_o_c_a_l_-_f_i_l_e_s
- Expand wild cards in the list of local files given as argu-
- ments and do a ppuutt for each file in the resulting list. See
- gglloobb for details of filename expansion. Resulting file names
- will then be processed according to nnttrraannss and nnmmaapp settings.
-
- nneewweerr _f_i_l_e_-_n_a_m_e
- Get the file only if the modification time of the remote file
- is more recent that the file on the current system. If the
- file does not exist on the current system, the remote file is
- considered nneewweerr. Otherwise, this command is identical to
- _g_e_t.
-
- nnlliisstt [_r_e_m_o_t_e_-_d_i_r_e_c_t_o_r_y] [_l_o_c_a_l_-_f_i_l_e]
- Print a list of the files in a directory on the remote
- machine. If _r_e_m_o_t_e_-_d_i_r_e_c_t_o_r_y is left unspecified, the cur-
- rent working directory is used. If interactive prompting is
- on, ffttpp will prompt the user to verify that the last argument
- is indeed the target local file for receiving nnlliisstt output.
- If no local file is specified, or if _l_o_c_a_l_-_f_i_l_e is --, the
- output is sent to the terminal.
-
- nnmmaapp [_i_n_p_a_t_t_e_r_n _o_u_t_p_a_t_t_e_r_n]
- Set or unset the filename mapping mechanism. If no arguments
- are specified, the filename mapping mechanism is unset. If
- arguments are specified, remote filenames are mapped during
- mmppuutt commands and ppuutt commands issued without a specified
- remote target filename. If arguments are specified, local
- filenames are mapped during mmggeett commands and ggeett commands
- issued without a specified local target filename. This com-
- mand is useful when connecting to a non-UNIX remote computer
- with different file naming conventions or practices. The
- mapping follows the pattern set by _i_n_p_a_t_t_e_r_n and _o_u_t_p_a_t_t_e_r_n.
- [_I_n_p_a_t_t_e_r_n] is a template for incoming filenames (which may
- have already been processed according to the nnttrraannss and ccaassee
- settings). Variable templating is accomplished by including
- the sequences `$1', `$2', ..., `$9' in _i_n_p_a_t_t_e_r_n. Use `\' to
- prevent this special treatment of the `$' character. All
- other characters are treated literally, and are used to
- determine the nnmmaapp [_i_n_p_a_t_t_e_r_n] variable values. For example,
- given _i_n_p_a_t_t_e_r_n $1.$2 and the remote file name "mydata.data",
- $1 would have the value "mydata", and $2 would have the value
- "data". The _o_u_t_p_a_t_t_e_r_n determines the resulting mapped file-
- name. The sequences `$1', `$2', ...., `$9' are replaced by
- any value resulting from the _i_n_p_a_t_t_e_r_n template. The
- sequence `$0' is replace by the original filename. Addition-
- ally, the sequence `[_s_e_q_1, _s_e_q_2]' is replaced by [_s_e_q_1] if
- _s_e_q_1 is not a null string; otherwise it is replaced by _s_e_q_2.
- For example, the command
-
- nmap $1.$2.$3 [$1,$2].[$2,file]
-
- would yield the output filename "myfile.data" for input file-
- names "myfile.data" and "myfile.data.old", "myfile.file" for
- the input filename "myfile", and "myfile.myfile" for the
- input filename ".myfile". Spaces may be included in
- _o_u_t_p_a_t_t_e_r_n, as in the example: `nmap $1 sed "s/ *$//" > $1'
- . Use the `\' character to prevent special treatment of the
- `$','[','[', and `,' characters.
-
- nnttrraannss [_i_n_c_h_a_r_s [_o_u_t_c_h_a_r_s]]
- Set or unset the filename character translation mechanism.
- If no arguments are specified, the filename character trans-
- lation mechanism is unset. If arguments are specified, char-
- acters in remote filenames are translated during mmppuutt com-
- mands and ppuutt commands issued without a specified remote tar-
- get filename. If arguments are specified, characters in
- local filenames are translated during mmggeett commands and ggeett
- commands issued without a specified local target filename.
- This command is useful when connecting to a non-UNIX remote
- computer with different file naming conventions or practices.
- Characters in a filename matching a character in _i_n_c_h_a_r_s are
- replaced with the corresponding character in _o_u_t_c_h_a_r_s. If
- the character's position in _i_n_c_h_a_r_s is longer than the length
- of _o_u_t_c_h_a_r_s, the character is deleted from the file name.
-
- ooppeenn _h_o_s_t [_p_o_r_t]
- Establish a connection to the specified _h_o_s_t FTP server. An
- optional port number may be supplied, in which case, ffttpp will
- attempt to contact an FTP server at that port. If the
- aauuttoo--llooggiinn option is on (default), ffttpp will also attempt to
- automatically log the user in to the FTP server (see below).
-
- ppaassssiivvee Toggle passive mode. If passive mode is turned on (default
- is off), the ftp client will send a PASV command for all data
- connections instead of the usual PORT command. The PASV com-
- mand requests that the remote server open a port for the data
- connection and return the address of that port. The remote
- server listens on that port and the client connects to it.
- When using the more traditional PORT command, the client lis-
- tens on a port and sends that address to the remote server,
- who connects back to it. Passive mode is useful when using
- ffttpp through a gateway router or host that controls the direc-
- tionality of traffic. (Note that though ftp servers are
- required to support the PASV command by RFC 1123, some do
- not.)
-
- pprroommpptt Toggle interactive prompting. Interactive prompting occurs
- during multiple file transfers to allow the user to selec-
- tively retrieve or store files. If prompting is turned off
- (default is on), any mmggeett or mmppuutt will transfer all files,
- and any mmddeelleettee will delete all files.
-
- pprrooxxyy _f_t_p_-_c_o_m_m_a_n_d
- Execute an ftp command on a secondary control connection.
- This command allows simultaneous connection to two remote ftp
- servers for transferring files between the two servers. The
- first pprrooxxyy command should be an ooppeenn, to establish the sec-
- ondary control connection. Enter the command "proxy ?" to
- see other ftp commands executable on the secondary connec-
- tion. The following commands behave differently when pref-
- aced by pprrooxxyy: ooppeenn will not define new macros during the
- auto-login process, cclloossee will not erase existing macro defi-
- nitions, ggeett and mmggeett transfer files from the host on the
- primary control connection to the host on the secondary con-
- trol connection, and ppuutt, mmppuutt, and aappppeenndd transfer files
- from the host on the secondary control connection to the host
- on the primary control connection. Third party file trans-
- fers depend upon support of the ftp protocol PASV command by
- the server on the secondary control connection.
-
- ppuutt _l_o_c_a_l_-_f_i_l_e [_r_e_m_o_t_e_-_f_i_l_e]
- Store a local file on the remote machine. If _r_e_m_o_t_e_-_f_i_l_e is
- left unspecified, the local file name is used after process-
- ing according to any nnttrraannss or nnmmaapp settings in naming the
- remote file. File transfer uses the current settings for
- ttyyppee, ffoorrmmaatt, mmooddee, and ssttrruuccttuurree.
-
- ppwwdd Print the name of the current working directory on the remote
- machine.
-
- qquuiitt A synonym for bbyyee.
-
- qquuoottee _a_r_g_1 _a_r_g_2 _._._.
- The arguments specified are sent, verbatim, to the remote FTP
- server.
-
- rreeccvv _r_e_m_o_t_e_-_f_i_l_e [_l_o_c_a_l_-_f_i_l_e]
- A synonym for get.
-
- rreeggeett _r_e_m_o_t_e_-_f_i_l_e [_l_o_c_a_l_-_f_i_l_e]
- Reget acts like get, except that if _l_o_c_a_l_-_f_i_l_e exists and is
- smaller than _r_e_m_o_t_e_-_f_i_l_e, _l_o_c_a_l_-_f_i_l_e is presumed to be a par-
- tially transferred copy of _r_e_m_o_t_e_-_f_i_l_e and the transfer is
- continued from the apparent point of failure. This command
- is useful when transferring very large files over networks
- that are prone to dropping connections.
-
- rreemmootteehheellpp [_c_o_m_m_a_n_d_-_n_a_m_e]
- Request help from the remote FTP server. If a _c_o_m_m_a_n_d_-_n_a_m_e
- is specified it is supplied to the server as well.
-
- rreemmootteessttaattuuss [_f_i_l_e_-_n_a_m_e]
- With no arguments, show status of remote machine. If
- _f_i_l_e_-_n_a_m_e is specified, show status of _f_i_l_e_-_n_a_m_e on remote
- machine.
-
- rreennaammee [_f_r_o_m] [_t_o]
- Rename the file _f_r_o_m on the remote machine, to the file _t_o.
-
- rreesseett Clear reply queue. This command re-synchronizes com-
- mand/reply sequencing with the remote ftp server. Resynchro-
- nization may be necessary following a violation of the ftp
- protocol by the remote server.
-
- rreessttaarrtt _m_a_r_k_e_r
- Restart the immediately following ggeett or ppuutt at the indicated
- _m_a_r_k_e_r. On UNIX systems, marker is usually a byte offset
- into the file.
-
- rrmmddiirr _d_i_r_e_c_t_o_r_y_-_n_a_m_e
- Delete a directory on the remote machine.
-
- rruunniiqquuee Toggle storing of files on the local system with unique file-
- names. If a file already exists with a name equal to the
- target local filename for a ggeett or mmggeett command, a ".1" is
- appended to the name. If the resulting name matches another
- existing file, a ".2" is appended to the original name. If
- this process continues up to ".99", an error message is
- printed, and the transfer does not take place. The generated
- unique filename will be reported. Note that rruunniiqquuee will not
- affect local files generated from a shell command (see
- below). The default value is off.
-
- sseenndd _l_o_c_a_l_-_f_i_l_e [_r_e_m_o_t_e_-_f_i_l_e]
- A synonym for put.
-
- sseennddppoorrtt Toggle the use of PORT commands. By default, ffttpp will
- attempt to use a PORT command when establishing a connection
- for each data transfer. The use of PORT commands can prevent
- delays when performing multiple file transfers. If the PORT
- command fails, ffttpp will use the default data port. When the
- use of PORT commands is disabled, no attempt will be made to
- use PORT commands for each data transfer. This is useful for
- certain FTP implementations which do ignore PORT commands
- but, incorrectly, indicate they've been accepted.
-
- ssiittee _a_r_g_1 _a_r_g_2 _._._.
- The arguments specified are sent, verbatim, to the remote FTP
- server as a SITE command.
-
- ssiizzee _f_i_l_e_-_n_a_m_e
- Return size of _f_i_l_e_-_n_a_m_e on remote machine.
-
- ssttaattuuss Show the current status of ffttpp.
-
- ssttrruucctt [_s_t_r_u_c_t_-_n_a_m_e]
- Set the file transfer _s_t_r_u_c_t_u_r_e to _s_t_r_u_c_t_-_n_a_m_e. By default
- ``stream'' structure is used.
-
- ssuunniiqquuee Toggle storing of files on remote machine under unique file
- names. Remote ftp server must support ftp protocol STOU com-
- mand for successful completion. The remote server will
- report unique name. Default value is off.
-
- ssyysstteemm Show the type of operating system running on the remote
- machine.
-
- tteenneexx Set the file transfer type to that needed to talk to TENEX
- machines.
-
- ttrraaccee Toggle packet tracing.
-
- ttyyppee [_t_y_p_e_-_n_a_m_e]
- Set the file transfer ttyyppee to _t_y_p_e_-_n_a_m_e. If no type is spec-
- ified, the current type is printed. The default type is net-
- work ASCII.
-
- uummaasskk [_n_e_w_m_a_s_k]
- Set the default umask on the remote server to _n_e_w_m_a_s_k. If
- _n_e_w_m_a_s_k is omitted, the current umask is printed.
-
- uusseerr _u_s_e_r_-_n_a_m_e [_p_a_s_s_w_o_r_d] [_a_c_c_o_u_n_t]
- Identify yourself to the remote FTP server. If the _p_a_s_s_w_o_r_d
- is not specified and the server requires it, ffttpp will prompt
- the user for it (after disabling local echo). If an _a_c_c_o_u_n_t
- field is not specified, and the FTP server requires it, the
- user will be prompted for it. If an _a_c_c_o_u_n_t field is speci-
- fied, an account command will be relayed to the remote server
- after the login sequence is completed if the remote server
- did not require it for logging in. Unless ffttpp is invoked
- with ``auto-login'' disabled, this process is done automati-
- cally on initial connection to the FTP server.
-
- vveerrbboossee Toggle verbose mode. In verbose mode, all responses from the
- FTP server are displayed to the user. In addition, if ver-
- bose is on, when a file transfer completes, statistics
- regarding the efficiency of the transfer are reported. By
- default, verbose is on.
-
- ?? [_c_o_m_m_a_n_d]
- A synonym for help.
-
- The following command can be used with ftpsec-aware servers.
-
- pprroott _c_l_e_a_r | _s_a_f_e | _c_o_n_f_i_d_e_n_t_i_a_l | _p_r_i_v_a_t_e
- Set the data protection level to the requested level.
-
- The following command can be used with ftp servers that has implemented
- the KAUTH site command.
-
- kkaauutthh [_p_r_i_n_c_i_p_a_l]
- Obtain remote tickets.
-
- Command arguments which have embedded spaces may be quoted with quote `"'
- marks.
-
-AABBOORRTTIINNGG AA FFIILLEE TTRRAANNSSFFEERR
- To abort a file transfer, use the terminal interrupt key (usually Ctrl-
- C). Sending transfers will be immediately halted. Receiving transfers
- will be halted by sending a ftp protocol ABOR command to the remote
- server, and discarding any further data received. The speed at which
- this is accomplished depends upon the remote server's support for ABOR
- processing. If the remote server does not support the ABOR command, an
- `ftp>' prompt will not appear until the remote server has completed send-
- ing the requested file.
-
- The terminal interrupt key sequence will be ignored when ffttpp has com-
- pleted any local processing and is awaiting a reply from the remote
- server. A long delay in this mode may result from the ABOR processing
- described above, or from unexpected behavior by the remote server,
- including violations of the ftp protocol. If the delay results from
- unexpected remote server behavior, the local ffttpp program must be killed
- by hand.
-
-FFIILLEE NNAAMMIINNGG CCOONNVVEENNTTIIOONNSS
- Files specified as arguments to ffttpp commands are processed according to
- the following rules.
-
- 1. If the file name `--' is specified, the _s_t_d_i_n (for reading) or _s_t_d_o_u_t
- (for writing) is used.
-
- 2. If the first character of the file name is `|', the remainder of the
- argument is interpreted as a shell command. FFttpp then forks a shell,
- using popen(3) with the argument supplied, and reads (writes) from
- the stdout (stdin). If the shell command includes spaces, the argu-
- ment must be quoted; e.g. ``" ls -lt"''. A particularly useful
- example of this mechanism is: ``dir more''.
-
- 3. Failing the above checks, if ``globbing'' is enabled, local file
- names are expanded according to the rules used in the csh(1); c.f.
- the gglloobb command. If the ffttpp command expects a single local file
- (.e.g. ppuutt), only the first filename generated by the "globbing"
- operation is used.
-
- 4. For mmggeett commands and ggeett commands with unspecified local file
- names, the local filename is the remote filename, which may be
- altered by a ccaassee, nnttrraannss, or nnmmaapp setting. The resulting filename
- may then be altered if rruunniiqquuee is on.
-
- 5. For mmppuutt commands and ppuutt commands with unspecified remote file
- names, the remote filename is the local filename, which may be
- altered by a nnttrraannss or nnmmaapp setting. The resulting filename may
- then be altered by the remote server if ssuunniiqquuee is on.
-
-FFIILLEE TTRRAANNSSFFEERR PPAARRAAMMEETTEERRSS
- The FTP specification specifies many parameters which may affect a file
- transfer. The ttyyppee may be one of ``ascii'', ``image'' (binary),
- ``ebcdic'', and ``local byte size'' (for PDP-10's and PDP-20's mostly).
- FFttpp supports the ascii and image types of file transfer, plus local byte
- size 8 for tteenneexx mode transfers.
-
- FFttpp supports only the default values for the remaining file transfer
- parameters: mmooddee, ffoorrmm, and ssttrruucctt.
-
-TTHHEE ..nneettrrcc FFIILLEE
- The _._n_e_t_r_c file contains login and initialization information used by the
- auto-login process. It resides in the user's home directory. The fol-
- lowing tokens are recognized; they may be separated by spaces, tabs, or
- new-lines:
-
- mmaacchhiinnee _n_a_m_e
- Identify a remote machine _n_a_m_e. The auto-login process
- searches the _._n_e_t_r_c file for a mmaacchhiinnee token that matches the
- remote machine specified on the ffttpp command line or as an ooppeenn
- command argument. Once a match is made, the subsequent _._n_e_t_r_c
- tokens are processed, stopping when the end of file is reached
- or another mmaacchhiinnee or a ddeeffaauulltt token is encountered.
-
- ddeeffaauulltt This is the same as mmaacchhiinnee _n_a_m_e except that ddeeffaauulltt matches
- any name. There can be only one ddeeffaauulltt token, and it must be
- after all mmaacchhiinnee tokens. This is normally used as:
-
- default login anonymous password user@site
-
- thereby giving the user _a_u_t_o_m_a_t_i_c anonymous ftp login to
- machines not specified in _._n_e_t_r_c. This can be overridden by
- using the --nn flag to disable auto-login.
-
- llooggiinn _n_a_m_e
- Identify a user on the remote machine. If this token is
- present, the auto-login process will initiate a login using the
- specified _n_a_m_e.
-
- ppaasssswwoorrdd _s_t_r_i_n_g
- Supply a password. If this token is present, the auto-login
- process will supply the specified string if the remote server
- requires a password as part of the login process. Note that if
- this token is present in the _._n_e_t_r_c file for any user other
- than _a_n_o_n_y_m_o_u_s, ffttpp will abort the auto-login process if the
- _._n_e_t_r_c is readable by anyone besides the user.
-
- aaccccoouunntt _s_t_r_i_n_g
- Supply an additional account password. If this token is
- present, the auto-login process will supply the specified
- string if the remote server requires an additional account
- password, or the auto-login process will initiate an ACCT com-
- mand if it does not.
-
- mmaaccddeeff _n_a_m_e
- Define a macro. This token functions like the ffttpp mmaaccddeeff com-
- mand functions. A macro is defined with the specified name;
- its contents begin with the next _._n_e_t_r_c line and continue until
- a null line (consecutive new-line characters) is encountered.
- If a macro named iinniitt is defined, it is automatically executed
- as the last step in the auto-login process.
-
-EENNVVIIRROONNMMEENNTT
- FFttpp uses the following environment variables.
-
- HOME For default location of a _._n_e_t_r_c file, if one exists.
-
- SHELL For default shell.
-
-SSEEEE AALLSSOO
- ftpd(8)
-
- _R_F_C_2_2_2_8.
-
-HHIISSTTOORRYY
- The ffttpp command appeared in 4.2BSD.
-
-BBUUGGSS
- Correct execution of many commands depends upon proper behavior by the
- remote server.
-
- An error in the treatment of carriage returns in the 4.2BSD ascii-mode
- transfer code has been corrected. This correction may result in incor-
- rect transfers of binary files to and from 4.2BSD servers using the ascii
- type. Avoid this problem by using the binary image type.
-
-4.2 Berkeley Distribution March 23, 2006 4.2 Berkeley Distribution
diff --git a/appl/ftp/ftp/ftp_locl.h b/appl/ftp/ftp/ftp_locl.h
deleted file mode 100644
index cae845a93ce1..000000000000
--- a/appl/ftp/ftp/ftp_locl.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright (c) 1995 - 2001 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the Institute nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/* $Id$ */
-
-#ifndef __FTP_LOCL_H__
-#define __FTP_LOCL_H__
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef HAVE_PWD_H
-#include <pwd.h>
-#endif
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#ifdef TIME_WITH_SYS_TIME
-#include <sys/time.h>
-#include <time.h>
-#elif defined(HAVE_SYS_TIME_H)
-#include <sys/time.h>
-#else
-#include <time.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
-#ifdef HAVE_SYS_RESOURCE_H
-#include <sys/resource.h>
-#endif
-#ifdef HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-#ifdef HAVE_NETINET_IN_SYSTM_H
-#include <netinet/in_systm.h>
-#endif
-#ifdef HAVE_NETINET_IP_H
-#include <netinet/ip.h>
-#endif
-
-#ifdef HAVE_ARPA_FTP_H
-#include <arpa/ftp.h>
-#endif
-#ifdef HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-#ifdef HAVE_ARPA_TELNET_H
-#include <arpa/telnet.h>
-#endif
-
-#include <errno.h>
-#include <ctype.h>
-#include <glob.h>
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif
-
-#ifdef HAVE_SYS_MMAN_H
-#include <sys/mman.h>
-#endif
-
-#include <err.h>
-
-#ifdef SOCKS
-#include <socks.h>
-extern int LIBPREFIX(fclose) (FILE *);
-
-/* This doesn't belong here. */
-struct tm *localtime(const time_t *);
-struct hostent *gethostbyname(const char *);
-
-#endif
-
-#include "ftp_var.h"
-#include "extern.h"
-#include "common.h"
-#include "pathnames.h"
-
-#include "roken.h"
-#include "security.h"
-
-/* des_read_pw_string */
-#include "crypto-headers.h"
-
-#if defined(__sun__) && !defined(__svr4)
-int fclose(FILE*);
-int pclose(FILE*);
-#endif
-
-#endif /* __FTP_LOCL_H__ */
diff --git a/appl/ftp/ftp/ftp_var.h b/appl/ftp/ftp/ftp_var.h
deleted file mode 100644
index 75ec495b76eb..000000000000
--- a/appl/ftp/ftp/ftp_var.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (c) 1985, 1989, 1993, 1994
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)ftp_var.h 8.4 (Berkeley) 10/9/94
- */
-
-/*
- * FTP global variables.
- */
-
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
-#include <setjmp.h>
-
-/*
- * Options and other state info.
- */
-extern int trace; /* trace packets exchanged */
-extern int hash; /* print # for each buffer transferred */
-extern int sendport; /* use PORT cmd for each data connection */
-extern int verbose; /* print messages coming back from server */
-extern int connected; /* connected to server */
-extern int fromatty; /* input is from a terminal */
-extern int interactive; /* interactively prompt on m* cmds */
-extern int lineedit; /* use line-editing */
-extern int debug; /* debugging level */
-extern int bell; /* ring bell on cmd completion */
-extern int doglob; /* glob local file names */
-extern int autologin; /* establish user account on connection */
-extern int doencrypt;
-extern int proxy; /* proxy server connection active */
-extern int proxflag; /* proxy connection exists */
-extern int sunique; /* store files on server with unique name */
-extern int runique; /* store local files with unique name */
-extern int mcase; /* map upper to lower case for mget names */
-extern int ntflag; /* use ntin ntout tables for name translation */
-extern int mapflag; /* use mapin mapout templates on file names */
-extern int code; /* return/reply code for ftp command */
-extern int crflag; /* if 1, strip car. rets. on ascii gets */
-extern char pasv[64]; /* passive port for proxy data connection */
-extern int passivemode; /* passive mode enabled */
-extern char *altarg; /* argv[1] with no shell-like preprocessing */
-extern char ntin[17]; /* input translation table */
-extern char ntout[17]; /* output translation table */
-extern char mapin[MaxPathLen]; /* input map template */
-extern char mapout[MaxPathLen]; /* output map template */
-extern char typename[32]; /* name of file transfer type */
-extern int type; /* requested file transfer type */
-extern int curtype; /* current file transfer type */
-extern char structname[32]; /* name of file transfer structure */
-extern int stru; /* file transfer structure */
-extern char formname[32]; /* name of file transfer format */
-extern int form; /* file transfer format */
-extern char modename[32]; /* name of file transfer mode */
-extern int mode; /* file transfer mode */
-extern char bytename[32]; /* local byte size in ascii */
-extern int bytesize; /* local byte size in binary */
-
-extern char *hostname; /* name of host connected to */
-extern int unix_server; /* server is unix, can use binary for ascii */
-extern int unix_proxy; /* proxy is unix, can use binary for ascii */
-
-extern jmp_buf toplevel; /* non-local goto stuff for cmd scanner */
-
-extern char line[200]; /* input line buffer */
-extern char *stringbase; /* current scan point in line buffer */
-extern char argbuf[200]; /* argument storage buffer */
-extern char *argbase; /* current storage point in arg buffer */
-extern int margc; /* count of arguments on input line */
-extern char **margv; /* args parsed from input line */
-extern int margvlen; /* how large margv is currently */
-extern int cpend; /* flag: if != 0, then pending server reply */
-extern int mflag; /* flag: if != 0, then active multi command */
-
-extern int options; /* used during socket creation */
-extern int use_kerberos; /* use Kerberos authentication */
-
-/*
- * Format of command table.
- */
-struct cmd {
- char *c_name; /* name of command */
- char *c_help; /* help string */
- char c_bell; /* give bell when command completes */
- char c_conn; /* must be connected to use command */
- char c_proxy; /* proxy server may execute */
- void (*c_handler) (int, char **); /* function to call */
-};
-
-struct macel {
- char mac_name[9]; /* macro name */
- char *mac_start; /* start of macro in macbuf */
- char *mac_end; /* end of macro in macbuf */
-};
-
-extern int macnum; /* number of defined macros */
-extern struct macel macros[16];
-extern char macbuf[4096];
-
-
diff --git a/appl/ftp/ftp/globals.c b/appl/ftp/ftp/globals.c
deleted file mode 100644
index 4c195f6e9e58..000000000000
--- a/appl/ftp/ftp/globals.c
+++ /dev/null
@@ -1,79 +0,0 @@
-#include "ftp_locl.h"
-RCSID("$Id$");
-
-/*
- * Options and other state info.
- */
-int trace; /* trace packets exchanged */
-int hash; /* print # for each buffer transferred */
-int sendport; /* use PORT cmd for each data connection */
-int verbose; /* print messages coming back from server */
-int connected; /* connected to server */
-int fromatty; /* input is from a terminal */
-int interactive; /* interactively prompt on m* cmds */
-int lineedit; /* use line-editing */
-int debug; /* debugging level */
-int bell; /* ring bell on cmd completion */
-int doglob; /* glob local file names */
-int doencrypt; /* try to use encryption */
-int autologin; /* establish user account on connection */
-int proxy; /* proxy server connection active */
-int proxflag; /* proxy connection exists */
-int sunique; /* store files on server with unique name */
-int runique; /* store local files with unique name */
-int mcase; /* map upper to lower case for mget names */
-int ntflag; /* use ntin ntout tables for name translation */
-int mapflag; /* use mapin mapout templates on file names */
-int code; /* return/reply code for ftp command */
-int crflag; /* if 1, strip car. rets. on ascii gets */
-char pasv[64]; /* passive port for proxy data connection */
-int passivemode; /* passive mode enabled */
-char *altarg; /* argv[1] with no shell-like preprocessing */
-char ntin[17]; /* input translation table */
-char ntout[17]; /* output translation table */
-char mapin[MaxPathLen]; /* input map template */
-char mapout[MaxPathLen]; /* output map template */
-char typename[32]; /* name of file transfer type */
-int type; /* requested file transfer type */
-int curtype; /* current file transfer type */
-char structname[32]; /* name of file transfer structure */
-int stru; /* file transfer structure */
-char formname[32]; /* name of file transfer format */
-int form; /* file transfer format */
-char modename[32]; /* name of file transfer mode */
-int mode; /* file transfer mode */
-char bytename[32]; /* local byte size in ascii */
-int bytesize; /* local byte size in binary */
-
-char *hostname; /* name of host connected to */
-int unix_server; /* server is unix, can use binary for ascii */
-int unix_proxy; /* proxy is unix, can use binary for ascii */
-
-jmp_buf toplevel; /* non-local goto stuff for cmd scanner */
-
-char line[200]; /* input line buffer */
-char *stringbase; /* current scan point in line buffer */
-char argbuf[200]; /* argument storage buffer */
-char *argbase; /* current storage point in arg buffer */
-int margc; /* count of arguments on input line */
-char **margv; /* args parsed from input line */
-int margvlen; /* how large margv is currently */
-int cpend; /* flag: if != 0, then pending server reply */
-int mflag; /* flag: if != 0, then active multi command */
-
-int options; /* used during socket creation */
-int use_kerberos; /* use Kerberos authentication */
-
-/*
- * Format of command table.
- */
-
-int macnum; /* number of defined macros */
-struct macel macros[16];
-char macbuf[4096];
-
-char username[32];
-
-/* these are set in ruserpassword */
-char myhostname[MaxHostNameLen];
-char *mydomain;
diff --git a/appl/ftp/ftp/gssapi.c b/appl/ftp/ftp/gssapi.c
deleted file mode 100644
index 29be7641c965..000000000000
--- a/appl/ftp/ftp/gssapi.c
+++ /dev/null
@@ -1,511 +0,0 @@
-/*
- * Copyright (c) 1998 - 2005 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the Institute nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifdef FTP_SERVER
-#include "ftpd_locl.h"
-#else
-#include "ftp_locl.h"
-#endif
-#include <gssapi/gssapi.h>
-#include <gssapi/gssapi_krb5.h>
-#include <krb5_err.h>
-
-RCSID("$Id$");
-
-int ftp_do_gss_bindings = 0;
-int ftp_do_gss_delegate = 1;
-
-struct gssapi_data {
- gss_ctx_id_t context_hdl;
- gss_name_t client_name;
- gss_cred_id_t delegated_cred_handle;
- void *mech_data;
-};
-
-static int
-gss_init(void *app_data)
-{
- struct gssapi_data *d = app_data;
- d->context_hdl = GSS_C_NO_CONTEXT;
- d->delegated_cred_handle = GSS_C_NO_CREDENTIAL;
-#if defined(FTP_SERVER)
- return 0;
-#else
- /* XXX Check the gss mechanism; with gss_indicate_mechs() ? */
-#ifdef KRB5
- return !use_kerberos;
-#else
- return 0;
-#endif /* KRB5 */
-#endif /* FTP_SERVER */
-}
-
-static int
-gss_check_prot(void *app_data, int level)
-{
- if(level == prot_confidential)
- return -1;
- return 0;
-}
-
-static int
-gss_decode(void *app_data, void *buf, int len, int level)
-{
- OM_uint32 maj_stat, min_stat;
- gss_buffer_desc input, output;
- gss_qop_t qop_state;
- int conf_state;
- struct gssapi_data *d = app_data;
- size_t ret_len;
-
- input.length = len;
- input.value = buf;
- maj_stat = gss_unwrap (&min_stat,
- d->context_hdl,
- &input,
- &output,
- &conf_state,
- &qop_state);
- if(GSS_ERROR(maj_stat))
- return -1;
- memmove(buf, output.value, output.length);
- ret_len = output.length;
- gss_release_buffer(&min_stat, &output);
- return ret_len;
-}
-
-static int
-gss_overhead(void *app_data, int level, int len)
-{
- return 100; /* dunno? */
-}
-
-
-static int
-gss_encode(void *app_data, void *from, int length, int level, void **to)
-{
- OM_uint32 maj_stat, min_stat;
- gss_buffer_desc input, output;
- int conf_state;
- struct gssapi_data *d = app_data;
-
- input.length = length;
- input.value = from;
- maj_stat = gss_wrap (&min_stat,
- d->context_hdl,
- level == prot_private,
- GSS_C_QOP_DEFAULT,
- &input,
- &conf_state,
- &output);
- *to = output.value;
- return output.length;
-}
-
-static void
-sockaddr_to_gss_address (struct sockaddr *sa,
- OM_uint32 *addr_type,
- gss_buffer_desc *gss_addr)
-{
- switch (sa->sa_family) {
-#ifdef HAVE_IPV6
- case AF_INET6 : {
- struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sa;
-
- gss_addr->length = 16;
- gss_addr->value = &sin6->sin6_addr;
- *addr_type = GSS_C_AF_INET6;
- break;
- }
-#endif
- case AF_INET : {
- struct sockaddr_in *sin4 = (struct sockaddr_in *)sa;
-
- gss_addr->length = 4;
- gss_addr->value = &sin4->sin_addr;
- *addr_type = GSS_C_AF_INET;
- break;
- }
- default :
- errx (1, "unknown address family %d", sa->sa_family);
-
- }
-}
-
-/* end common stuff */
-
-#ifdef FTP_SERVER
-
-static int
-gss_adat(void *app_data, void *buf, size_t len)
-{
- char *p = NULL;
- gss_buffer_desc input_token, output_token;
- OM_uint32 maj_stat, min_stat;
- gss_name_t client_name;
- struct gssapi_data *d = app_data;
- gss_channel_bindings_t bindings;
-
- if (ftp_do_gss_bindings) {
- bindings = malloc(sizeof(*bindings));
- if (bindings == NULL)
- errx(1, "out of memory");
-
- sockaddr_to_gss_address (his_addr,
- &bindings->initiator_addrtype,
- &bindings->initiator_address);
- sockaddr_to_gss_address (ctrl_addr,
- &bindings->acceptor_addrtype,
- &bindings->acceptor_address);
-
- bindings->application_data.length = 0;
- bindings->application_data.value = NULL;
- } else
- bindings = GSS_C_NO_CHANNEL_BINDINGS;
-
- input_token.value = buf;
- input_token.length = len;
-
- maj_stat = gss_accept_sec_context (&min_stat,
- &d->context_hdl,
- GSS_C_NO_CREDENTIAL,
- &input_token,
- bindings,
- &client_name,
- NULL,
- &output_token,
- NULL,
- NULL,
- &d->delegated_cred_handle);
-
- if (bindings != GSS_C_NO_CHANNEL_BINDINGS)
- free(bindings);
-
- if(output_token.length) {
- if(base64_encode(output_token.value, output_token.length, &p) < 0) {
- reply(535, "Out of memory base64-encoding.");
- return -1;
- }
- gss_release_buffer(&min_stat, &output_token);
- }
- if(maj_stat == GSS_S_COMPLETE){
- d->client_name = client_name;
- client_name = GSS_C_NO_NAME;
- if(p)
- reply(235, "ADAT=%s", p);
- else
- reply(235, "ADAT Complete");
- sec_complete = 1;
-
- } else if(maj_stat == GSS_S_CONTINUE_NEEDED) {
- if(p)
- reply(335, "ADAT=%s", p);
- else
- reply(335, "OK, need more data");
- } else {
- OM_uint32 new_stat;
- OM_uint32 msg_ctx = 0;
- gss_buffer_desc status_string;
- gss_display_status(&new_stat,
- min_stat,
- GSS_C_MECH_CODE,
- GSS_C_NO_OID,
- &msg_ctx,
- &status_string);
- syslog(LOG_ERR, "gss_accept_sec_context: %.*s",
- (int)status_string.length,
- (char*)status_string.value);
- gss_release_buffer(&new_stat, &status_string);
- reply(431, "Security resource unavailable");
- }
-
- if (client_name)
- gss_release_name(&min_stat, &client_name);
- free(p);
- return 0;
-}
-
-int gssapi_userok(void*, char*);
-int gssapi_session(void*, char*);
-
-struct sec_server_mech gss_server_mech = {
- "GSSAPI",
- sizeof(struct gssapi_data),
- gss_init, /* init */
- NULL, /* end */
- gss_check_prot,
- gss_overhead,
- gss_encode,
- gss_decode,
- /* */
- NULL,
- gss_adat,
- NULL, /* pbsz */
- NULL, /* ccc */
- gssapi_userok,
- gssapi_session
-};
-
-#else /* FTP_SERVER */
-
-extern struct sockaddr *hisctladdr, *myctladdr;
-
-static int
-import_name(const char *kname, const char *host, gss_name_t *target_name)
-{
- OM_uint32 maj_stat, min_stat;
- gss_buffer_desc name;
- char *str;
-
- name.length = asprintf(&str, "%s@%s", kname, host);
- if (str == NULL) {
- printf("Out of memory\n");
- return AUTH_ERROR;
- }
- name.value = str;
-
- maj_stat = gss_import_name(&min_stat,
- &name,
- GSS_C_NT_HOSTBASED_SERVICE,
- target_name);
- if (GSS_ERROR(maj_stat)) {
- OM_uint32 new_stat;
- OM_uint32 msg_ctx = 0;
- gss_buffer_desc status_string;
-
- gss_display_status(&new_stat,
- min_stat,
- GSS_C_MECH_CODE,
- GSS_C_NO_OID,
- &msg_ctx,
- &status_string);
- printf("Error importing name %.*s: %.*s\n",
- (int)name.length,
- (char *)name.value,
- (int)status_string.length,
- (char *)status_string.value);
- free(name.value);
- gss_release_buffer(&new_stat, &status_string);
- return AUTH_ERROR;
- }
- free(name.value);
- return 0;
-}
-
-static int
-gss_auth(void *app_data, char *host)
-{
-
- OM_uint32 maj_stat, min_stat;
- gss_name_t target_name;
- gss_buffer_desc input, output_token;
- int context_established = 0;
- char *p;
- int n;
- gss_channel_bindings_t bindings;
- struct gssapi_data *d = app_data;
- OM_uint32 mech_flags = GSS_C_MUTUAL_FLAG | GSS_C_SEQUENCE_FLAG;
-
- const char *knames[] = { "ftp", "host", NULL }, **kname = knames;
-
-
- if(import_name(*kname++, host, &target_name))
- return AUTH_ERROR;
-
- input.length = 0;
- input.value = NULL;
-
- if (ftp_do_gss_bindings) {
- bindings = malloc(sizeof(*bindings));
- if (bindings == NULL)
- errx(1, "out of memory");
-
- sockaddr_to_gss_address (myctladdr,
- &bindings->initiator_addrtype,
- &bindings->initiator_address);
- sockaddr_to_gss_address (hisctladdr,
- &bindings->acceptor_addrtype,
- &bindings->acceptor_address);
-
- bindings->application_data.length = 0;
- bindings->application_data.value = NULL;
- } else
- bindings = GSS_C_NO_CHANNEL_BINDINGS;
-
- if (ftp_do_gss_delegate)
- mech_flags |= GSS_C_DELEG_FLAG;
-
- while(!context_established) {
- maj_stat = gss_init_sec_context(&min_stat,
- GSS_C_NO_CREDENTIAL,
- &d->context_hdl,
- target_name,
- GSS_C_NO_OID,
- mech_flags,
- 0,
- bindings,
- &input,
- NULL,
- &output_token,
- NULL,
- NULL);
- if (GSS_ERROR(maj_stat)) {
- OM_uint32 new_stat;
- OM_uint32 msg_ctx = 0;
- gss_buffer_desc status_string;
-
- d->context_hdl = GSS_C_NO_CONTEXT;
-
- gss_release_name(&min_stat, &target_name);
-
- if(*kname != NULL) {
-
- if(import_name(*kname++, host, &target_name)) {
- if (bindings != GSS_C_NO_CHANNEL_BINDINGS)
- free(bindings);
- return AUTH_ERROR;
- }
- continue;
- }
-
- if (bindings != GSS_C_NO_CHANNEL_BINDINGS)
- free(bindings);
-
- gss_display_status(&new_stat,
- min_stat,
- GSS_C_MECH_CODE,
- GSS_C_NO_OID,
- &msg_ctx,
- &status_string);
- printf("Error initializing security context: %.*s\n",
- (int)status_string.length,
- (char*)status_string.value);
- gss_release_buffer(&new_stat, &status_string);
- return AUTH_CONTINUE;
- }
-
- if (input.value) {
- free(input.value);
- input.value = NULL;
- input.length = 0;
- }
- if (output_token.length != 0) {
- base64_encode(output_token.value, output_token.length, &p);
- gss_release_buffer(&min_stat, &output_token);
- n = command("ADAT %s", p);
- free(p);
- }
- if (GSS_ERROR(maj_stat)) {
- if (d->context_hdl != GSS_C_NO_CONTEXT)
- gss_delete_sec_context (&min_stat,
- &d->context_hdl,
- GSS_C_NO_BUFFER);
- break;
- }
- if (maj_stat & GSS_S_CONTINUE_NEEDED) {
- p = strstr(reply_string, "ADAT=");
- if(p == NULL){
- printf("Error: expected ADAT in reply. got: %s\n",
- reply_string);
- if (bindings != GSS_C_NO_CHANNEL_BINDINGS)
- free(bindings);
- return AUTH_ERROR;
- } else {
- p+=5;
- input.value = malloc(strlen(p));
- input.length = base64_decode(p, input.value);
- }
- } else {
- if(code != 235) {
- printf("Unrecognized response code: %d\n", code);
- if (bindings != GSS_C_NO_CHANNEL_BINDINGS)
- free(bindings);
- return AUTH_ERROR;
- }
- context_established = 1;
- }
- }
-
- gss_release_name(&min_stat, &target_name);
-
- if (bindings != GSS_C_NO_CHANNEL_BINDINGS)
- free(bindings);
- if (input.value)
- free(input.value);
-
- {
- gss_name_t targ_name;
-
- maj_stat = gss_inquire_context(&min_stat,
- d->context_hdl,
- NULL,
- &targ_name,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL);
- if (GSS_ERROR(maj_stat) == 0) {
- gss_buffer_desc name;
- maj_stat = gss_display_name (&min_stat,
- targ_name,
- &name,
- NULL);
- if (GSS_ERROR(maj_stat) == 0) {
- printf("Authenticated to <%.*s>\n",
- (int)name.length,
- (char *)name.value);
- gss_release_buffer(&min_stat, &name);
- }
- gss_release_name(&min_stat, &targ_name);
- } else
- printf("Failed to get gss name of peer.\n");
- }
-
-
- return AUTH_OK;
-}
-
-struct sec_client_mech gss_client_mech = {
- "GSSAPI",
- sizeof(struct gssapi_data),
- gss_init,
- gss_auth,
- NULL, /* end */
- gss_check_prot,
- gss_overhead,
- gss_encode,
- gss_decode,
-};
-
-#endif /* FTP_SERVER */
diff --git a/appl/ftp/ftp/kauth.c b/appl/ftp/ftp/kauth.c
deleted file mode 100644
index 3af44aa7d6a4..000000000000
--- a/appl/ftp/ftp/kauth.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 1995-1999 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the Institute nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "ftp_locl.h"
-RCSID("$Id$");
-
-#if defined(KRB5)
-
-void
-afslog(int argc, char **argv)
-{
- int ret;
- if(argc > 2) {
- printf("usage: %s [cell]\n", argv[0]);
- code = -1;
- return;
- }
- if(argc == 2)
- ret = command("SITE AFSLOG %s", argv[1]);
- else
- ret = command("SITE AFSLOG");
- code = (ret == COMPLETE);
-}
-
-#else
-int ftp_afslog_placeholder;
-#endif
diff --git a/appl/ftp/ftp/main.c b/appl/ftp/ftp/main.c
deleted file mode 100644
index 5876f51dc4dd..000000000000
--- a/appl/ftp/ftp/main.c
+++ /dev/null
@@ -1,590 +0,0 @@
-/*
- * Copyright (c) 1985, 1989, 1993, 1994
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * FTP User Program -- Command Interface.
- */
-
-#include "ftp_locl.h"
-#include <getarg.h>
-
-RCSID("$Id$");
-
-static int help_flag;
-static int version_flag;
-static int debug_flag;
-
-struct getargs getargs[] = {
- { NULL, 'd', arg_flag, &debug_flag,
- "debug", NULL },
- { NULL, 'g', arg_negative_flag, &doglob,
- "disables globbing", NULL},
- { NULL, 'i', arg_negative_flag, &interactive,
- "Turn off interactive prompting", NULL},
- { NULL, 'l', arg_negative_flag, &lineedit,
- "Turn off line editing", NULL},
- { NULL, 'n', arg_negative_flag, &autologin,
- "Turn off auto-login", NULL},
- { NULL, 'p', arg_flag, &passivemode,
- "passive mode", NULL},
- { NULL, 't', arg_counter, &trace,
- "Packet tracing", NULL},
-#ifdef KRB5
- { "gss-bindings", 0, arg_negative_flag, &ftp_do_gss_bindings,
- "Don't use GSS-API bindings", NULL},
- { "gss-delegate", 0, arg_negative_flag, &ftp_do_gss_delegate,
- "Disable delegation of GSS-API credentials", NULL},
-#endif
- { NULL, 'v', arg_counter, &verbose,
- "verbosity", NULL},
- { NULL, 'K', arg_negative_flag, &use_kerberos,
- "Disable kerberos authentication", NULL},
- { "encrypt", 'x', arg_flag, &doencrypt,
- "Encrypt command and data channel if possible" },
- { "version", 0, arg_flag, &version_flag },
- { "help", 'h', arg_flag, &help_flag },
-};
-
-static int num_args = sizeof(getargs) / sizeof(getargs[0]);
-
-static void
-usage(int ecode)
-{
- arg_printusage(getargs, num_args, NULL, "[host [port]]");
- exit(ecode);
-}
-
-int
-main(int argc, char **argv)
-{
- int top;
- struct passwd *pw = NULL;
- char homedir[MaxPathLen];
- struct servent *sp;
- int optind = 0;
-
- setprogname(argv[0]);
-
- sp = getservbyname("ftp", "tcp");
- if (sp == 0)
- errx(1, "ftp/tcp: unknown service");
- doglob = 1;
- interactive = 1;
- autologin = 1;
- lineedit = 1;
- passivemode = 0; /* passive mode not active */
- use_kerberos = 1;
-#ifdef KRB5
- ftp_do_gss_bindings = 1;
-#endif
-
- if(getarg(getargs, num_args, argc, argv, &optind))
- usage(1);
- if(help_flag)
- usage(0);
- if(version_flag) {
- print_version(NULL);
- exit(0);
- }
-
- if (debug_flag) {
- options |= SO_DEBUG;
- debug++;
- }
-
- argc -= optind;
- argv += optind;
-
- fromatty = isatty(fileno(stdin));
- if (fromatty)
- verbose++;
- cpend = 0; /* no pending replies */
- proxy = 0; /* proxy not active */
- crflag = 1; /* strip c.r. on ascii gets */
- sendport = -1; /* not using ports */
- /*
- * Set up the home directory in case we're globbing.
- */
- pw = k_getpwuid(getuid());
- if (pw != NULL) {
- strlcpy(homedir, pw->pw_dir, sizeof(homedir));
- home = homedir;
- }
- if (argc > 0) {
- char *xargv[5];
-
- if (setjmp(toplevel))
- exit(0);
- signal(SIGINT, intr);
- signal(SIGPIPE, lostpeer);
- xargv[0] = (char*)getprogname();
- xargv[1] = argv[0];
- xargv[2] = argv[1];
- xargv[3] = argv[2];
- xargv[4] = NULL;
- setpeer(argc+1, xargv);
- }
- if(setjmp(toplevel) == 0)
- top = 1;
- else
- top = 0;
- if (top) {
- signal(SIGINT, intr);
- signal(SIGPIPE, lostpeer);
- }
- for (;;) {
- cmdscanner(top);
- top = 1;
- }
-}
-
-void
-intr(int sig)
-{
-
- longjmp(toplevel, 1);
-}
-
-#ifndef SHUT_RDWR
-#define SHUT_RDWR 2
-#endif
-
-RETSIGTYPE
-lostpeer(int sig)
-{
-
- if (connected) {
- if (cout != NULL) {
- shutdown(fileno(cout), SHUT_RDWR);
- fclose(cout);
- cout = NULL;
- }
- if (data >= 0) {
- shutdown(data, SHUT_RDWR);
- close(data);
- data = -1;
- }
- connected = 0;
- }
- pswitch(1);
- if (connected) {
- if (cout != NULL) {
- shutdown(fileno(cout), SHUT_RDWR);
- fclose(cout);
- cout = NULL;
- }
- connected = 0;
- }
- proxflag = 0;
- pswitch(0);
- sec_end();
- SIGRETURN(0);
-}
-
-/*
-char *
-tail(filename)
- char *filename;
-{
- char *s;
-
- while (*filename) {
- s = strrchr(filename, '/');
- if (s == NULL)
- break;
- if (s[1])
- return (s + 1);
- *s = '\0';
- }
- return (filename);
-}
-*/
-
-static char *
-simple_readline(char *prompt)
-{
- char buf[BUFSIZ];
- printf ("%s", prompt);
- fflush (stdout);
- if(fgets(buf, sizeof(buf), stdin) == NULL)
- return NULL;
- if (buf[strlen(buf) - 1] == '\n')
- buf[strlen(buf) - 1] = '\0';
- return strdup(buf);
-}
-
-#ifndef HAVE_READLINE
-
-static char *
-readline(char *prompt)
-{
- return simple_readline (prompt);
-}
-
-static void
-add_history(char *p)
-{
-}
-
-#else
-
-/* These should not really be here */
-
-char *readline(char *);
-void add_history(char *);
-
-#endif
-
-/*
- * Command parser.
- */
-void
-cmdscanner(int top)
-{
- struct cmd *c;
- int l;
-
- if (!top)
- putchar('\n');
- for (;;) {
- if (fromatty) {
- char *p;
- if (lineedit)
- p = readline("ftp> ");
- else
- p = simple_readline("ftp> ");
- if(p == NULL) {
- printf("\n");
- quit(0, 0);
- }
- strlcpy(line, p, sizeof(line));
- if (lineedit)
- add_history(p);
- free(p);
- } else{
- if (fgets(line, sizeof line, stdin) == NULL)
- quit(0, 0);
- }
- /* XXX will break on long lines */
- l = strlen(line);
- if (l == 0)
- break;
- if (line[--l] == '\n') {
- if (l == 0)
- break;
- line[l] = '\0';
- } else if (l == sizeof(line) - 2) {
- printf("sorry, input line too long\n");
- while ((l = getchar()) != '\n' && l != EOF)
- /* void */;
- break;
- } /* else it was a line without a newline */
- makeargv();
- if (margc == 0) {
- continue;
- }
- c = getcmd(margv[0]);
- if (c == (struct cmd *)-1) {
- printf("?Ambiguous command\n");
- continue;
- }
- if (c == 0) {
- printf("?Invalid command\n");
- continue;
- }
- if (c->c_conn && !connected) {
- printf("Not connected.\n");
- continue;
- }
- (*c->c_handler)(margc, margv);
- if (bell && c->c_bell)
- putchar('\007');
- if (c->c_handler != help)
- break;
- }
- signal(SIGINT, intr);
- signal(SIGPIPE, lostpeer);
-}
-
-struct cmd *
-getcmd(char *name)
-{
- char *p, *q;
- struct cmd *c, *found;
- int nmatches, longest;
-
- longest = 0;
- nmatches = 0;
- found = 0;
- for (c = cmdtab; (p = c->c_name); c++) {
- for (q = name; *q == *p++; q++)
- if (*q == 0) /* exact match? */
- return (c);
- if (!*q) { /* the name was a prefix */
- if (q - name > longest) {
- longest = q - name;
- nmatches = 1;
- found = c;
- } else if (q - name == longest)
- nmatches++;
- }
- }
- if (nmatches > 1)
- return ((struct cmd *)-1);
- return (found);
-}
-
-/*
- * Slice a string up into argc/argv.
- */
-
-int slrflag;
-
-void
-makeargv(void)
-{
- char **argp;
-
- argp = margv;
- stringbase = line; /* scan from first of buffer */
- argbase = argbuf; /* store from first of buffer */
- slrflag = 0;
- for (margc = 0; ; margc++) {
- /* Expand array if necessary */
- if (margc == margvlen) {
- int i;
-
- margv = (margvlen == 0)
- ? (char **)malloc(20 * sizeof(char *))
- : (char **)realloc(margv,
- (margvlen + 20)*sizeof(char *));
- if (margv == NULL)
- errx(1, "cannot realloc argv array");
- for(i = margvlen; i < margvlen + 20; ++i)
- margv[i] = NULL;
- margvlen += 20;
- argp = margv + margc;
- }
-
- if ((*argp++ = slurpstring()) == NULL)
- break;
- }
-
-}
-
-/*
- * Parse string into argbuf;
- * implemented with FSM to
- * handle quoting and strings
- */
-char *
-slurpstring(void)
-{
- int got_one = 0;
- char *sb = stringbase;
- char *ap = argbase;
- char *tmp = argbase; /* will return this if token found */
-
- if (*sb == '!' || *sb == '$') { /* recognize ! as a token for shell */
- switch (slrflag) { /* and $ as token for macro invoke */
- case 0:
- slrflag++;
- stringbase++;
- return ((*sb == '!') ? "!" : "$");
- /* NOTREACHED */
- case 1:
- slrflag++;
- altarg = stringbase;
- break;
- default:
- break;
- }
- }
-
-S0:
- switch (*sb) {
-
- case '\0':
- goto OUT;
-
- case ' ':
- case '\t':
- sb++; goto S0;
-
- default:
- switch (slrflag) {
- case 0:
- slrflag++;
- break;
- case 1:
- slrflag++;
- altarg = sb;
- break;
- default:
- break;
- }
- goto S1;
- }
-
-S1:
- switch (*sb) {
-
- case ' ':
- case '\t':
- case '\0':
- goto OUT; /* end of token */
-
- case '\\':
- sb++; goto S2; /* slurp next character */
-
- case '"':
- sb++; goto S3; /* slurp quoted string */
-
- default:
- *ap++ = *sb++; /* add character to token */
- got_one = 1;
- goto S1;
- }
-
-S2:
- switch (*sb) {
-
- case '\0':
- goto OUT;
-
- default:
- *ap++ = *sb++;
- got_one = 1;
- goto S1;
- }
-
-S3:
- switch (*sb) {
-
- case '\0':
- goto OUT;
-
- case '"':
- sb++; goto S1;
-
- default:
- *ap++ = *sb++;
- got_one = 1;
- goto S3;
- }
-
-OUT:
- if (got_one)
- *ap++ = '\0';
- argbase = ap; /* update storage pointer */
- stringbase = sb; /* update scan pointer */
- if (got_one) {
- return (tmp);
- }
- switch (slrflag) {
- case 0:
- slrflag++;
- break;
- case 1:
- slrflag++;
- altarg = (char *) 0;
- break;
- default:
- break;
- }
- return NULL;
-}
-
-#define HELPINDENT ((int) sizeof ("directory"))
-
-/*
- * Help command.
- * Call each command handler with argc == 0 and argv[0] == name.
- */
-void
-help(int argc, char **argv)
-{
- struct cmd *c;
-
- if (argc == 1) {
- int i, j, w, k;
- int columns, width = 0, lines;
-
- printf("Commands may be abbreviated. Commands are:\n\n");
- for (c = cmdtab; c < &cmdtab[NCMDS]; c++) {
- int len = strlen(c->c_name);
-
- if (len > width)
- width = len;
- }
- width = (width + 8) &~ 7;
- columns = 80 / width;
- if (columns == 0)
- columns = 1;
- lines = (NCMDS + columns - 1) / columns;
- for (i = 0; i < lines; i++) {
- for (j = 0; j < columns; j++) {
- c = cmdtab + j * lines + i;
- if ((!proxy || c->c_proxy)) {
- printf("%s", c->c_name);
- } else {
- for (k=0; k < strlen(c->c_name); k++) {
- putchar(' ');
- }
- }
- if (c + lines >= &cmdtab[NCMDS]) {
- printf("\n");
- break;
- }
- w = strlen(c->c_name);
- while (w < width) {
- w = (w + 8) &~ 7;
- putchar('\t');
- }
- }
- }
- return;
- }
- while (--argc > 0) {
- char *arg;
- arg = *++argv;
- c = getcmd(arg);
- if (c == (struct cmd *)-1)
- printf("?Ambiguous help command %s\n", arg);
- else if (c == (struct cmd *)0)
- printf("?Invalid help command %s\n", arg);
- else
- printf("%-*s\t%s\n", HELPINDENT,
- c->c_name, c->c_help);
- }
-}
diff --git a/appl/ftp/ftp/pathnames.h b/appl/ftp/ftp/pathnames.h
deleted file mode 100644
index f7c1fb391d69..000000000000
--- a/appl/ftp/ftp/pathnames.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)pathnames.h 8.1 (Berkeley) 6/6/93
- */
-
-#ifdef HAVE_PATHS_H
-#include <paths.h>
-#endif
-
-#define _PATH_TMP_XXX "/tmp/ftpXXXXXX"
-
-#ifndef _PATH_BSHELL
-#define _PATH_BSHELL "/bin/sh"
-#endif
diff --git a/appl/ftp/ftp/ruserpass.c b/appl/ftp/ftp/ruserpass.c
deleted file mode 100644
index a8665b643c53..000000000000
--- a/appl/ftp/ftp/ruserpass.c
+++ /dev/null
@@ -1,313 +0,0 @@
-/*
- * Copyright (c) 1985, 1993, 1994
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "ftp_locl.h"
-RCSID("$Id$");
-
-static int token (void);
-static FILE *cfile;
-
-#define DEFAULT 1
-#define LOGIN 2
-#define PASSWD 3
-#define ACCOUNT 4
-#define MACDEF 5
-#define PROT 6
-#define ID 10
-#define MACH 11
-
-static char tokval[100];
-
-static struct toktab {
- char *tokstr;
- int tval;
-} toktab[]= {
- { "default", DEFAULT },
- { "login", LOGIN },
- { "password", PASSWD },
- { "passwd", PASSWD },
- { "account", ACCOUNT },
- { "machine", MACH },
- { "macdef", MACDEF },
- { "prot", PROT },
- { NULL, 0 }
-};
-
-/*
- * Write a copy of the hostname into `hostname, sz' and return a guess
- * as to the `domain' of that hostname.
- */
-
-static char *
-guess_domain (char *hostname_str, size_t sz)
-{
- struct addrinfo *ai, *a;
- struct addrinfo hints;
- int error;
- char *dot;
-
- if (gethostname (hostname_str, sz) < 0) {
- strlcpy (hostname_str, "", sz);
- return "";
- }
- dot = strchr (hostname_str, '.');
- if (dot != NULL)
- return dot + 1;
-
- memset (&hints, 0, sizeof(hints));
- hints.ai_flags = AI_CANONNAME;
-
- error = getaddrinfo (hostname_str, NULL, &hints, &ai);
- if (error)
- return hostname_str;
-
- for (a = ai; a != NULL; a = a->ai_next)
- if (a->ai_canonname != NULL) {
- strlcpy (hostname_str, ai->ai_canonname, sz);
- break;
- }
- freeaddrinfo (ai);
- dot = strchr (hostname_str, '.');
- if (dot != NULL)
- return dot + 1;
- else
- return hostname_str;
-}
-
-int
-ruserpassword(char *host, char **aname, char **apass, char **aacct)
-{
- char *hdir, buf[BUFSIZ], *tmp;
- int t, i, c, usedefault = 0;
- struct stat stb;
-
- mydomain = guess_domain (myhostname, MaxHostNameLen);
-
- hdir = getenv("HOME");
- if (hdir == NULL)
- hdir = ".";
- snprintf(buf, sizeof(buf), "%s/.netrc", hdir);
- cfile = fopen(buf, "r");
- if (cfile == NULL) {
- if (errno != ENOENT)
- warn("%s", buf);
- return (0);
- }
-
-next:
- while ((t = token())) switch(t) {
-
- case DEFAULT:
- usedefault = 1;
- /* FALL THROUGH */
-
- case MACH:
- if (!usedefault) {
- if (token() != ID)
- continue;
- /*
- * Allow match either for user's input host name
- * or official hostname. Also allow match of
- * incompletely-specified host in local domain.
- */
- if (strcasecmp(host, tokval) == 0)
- goto match;
- if (strcasecmp(hostname, tokval) == 0)
- goto match;
- if ((tmp = strchr(hostname, '.')) != NULL &&
- tmp++ &&
- strcasecmp(tmp, mydomain) == 0 &&
- strncasecmp(hostname, tokval, tmp-hostname) == 0 &&
- tokval[tmp - hostname] == '\0')
- goto match;
- if ((tmp = strchr(host, '.')) != NULL &&
- tmp++ &&
- strcasecmp(tmp, mydomain) == 0 &&
- strncasecmp(host, tokval, tmp - host) == 0 &&
- tokval[tmp - host] == '\0')
- goto match;
- continue;
- }
- match:
- while ((t = token()) && t != MACH && t != DEFAULT) switch(t) {
-
- case LOGIN:
- if (token()) {
- if (*aname == 0) {
- *aname = strdup(tokval);
- } else {
- if (strcmp(*aname, tokval))
- goto next;
- }
- }
- break;
- case PASSWD:
- if ((*aname == NULL || strcmp(*aname, "anonymous")) &&
- fstat(fileno(cfile), &stb) >= 0 &&
- (stb.st_mode & 077) != 0) {
- warnx("Error: .netrc file is readable by others.");
- warnx("Remove password or make file unreadable by others.");
- goto bad;
- }
- if (token() && *apass == 0) {
- *apass = strdup(tokval);
- }
- break;
- case ACCOUNT:
- if (fstat(fileno(cfile), &stb) >= 0
- && (stb.st_mode & 077) != 0) {
- warnx("Error: .netrc file is readable by others.");
- warnx("Remove account or make file unreadable by others.");
- goto bad;
- }
- if (token() && *aacct == 0) {
- *aacct = strdup(tokval);
- }
- break;
- case MACDEF:
- if (proxy) {
- fclose(cfile);
- return (0);
- }
- while ((c=getc(cfile)) != EOF &&
- (c == ' ' || c == '\t'));
- if (c == EOF || c == '\n') {
- printf("Missing macdef name argument.\n");
- goto bad;
- }
- if (macnum == 16) {
- printf("Limit of 16 macros have already been defined\n");
- goto bad;
- }
- tmp = macros[macnum].mac_name;
- *tmp++ = c;
- for (i=0; i < 8 && (c=getc(cfile)) != EOF &&
- !isspace(c); ++i) {
- *tmp++ = c;
- }
- if (c == EOF) {
- printf("Macro definition missing null line terminator.\n");
- goto bad;
- }
- *tmp = '\0';
- if (c != '\n') {
- while ((c=getc(cfile)) != EOF && c != '\n');
- }
- if (c == EOF) {
- printf("Macro definition missing null line terminator.\n");
- goto bad;
- }
- if (macnum == 0) {
- macros[macnum].mac_start = macbuf;
- }
- else {
- macros[macnum].mac_start = macros[macnum-1].mac_end + 1;
- }
- tmp = macros[macnum].mac_start;
- while (tmp != macbuf + 4096) {
- if ((c=getc(cfile)) == EOF) {
- printf("Macro definition missing null line terminator.\n");
- goto bad;
- }
- *tmp = c;
- if (*tmp == '\n') {
- if (*(tmp-1) == '\0') {
- macros[macnum++].mac_end = tmp - 1;
- break;
- }
- *tmp = '\0';
- }
- tmp++;
- }
- if (tmp == macbuf + 4096) {
- printf("4K macro buffer exceeded\n");
- goto bad;
- }
- break;
- case PROT:
- token();
- if(doencrypt == 0 && sec_request_prot(tokval) < 0)
- warnx("Unknown protection level \"%s\"", tokval);
- break;
- default:
- warnx("Unknown .netrc keyword %s", tokval);
- break;
- }
- goto done;
- }
-done:
- fclose(cfile);
- return (0);
-bad:
- fclose(cfile);
- return (-1);
-}
-
-static int
-token(void)
-{
- char *cp;
- int c;
- struct toktab *t;
-
- if (feof(cfile) || ferror(cfile))
- return (0);
- while ((c = getc(cfile)) != EOF &&
- (c == '\n' || c == '\t' || c == ' ' || c == ','))
- continue;
- if (c == EOF)
- return (0);
- cp = tokval;
- if (c == '"') {
- while ((c = getc(cfile)) != EOF && c != '"') {
- if (c == '\\')
- c = getc(cfile);
- *cp++ = c;
- }
- } else {
- *cp++ = c;
- while ((c = getc(cfile)) != EOF
- && c != '\n' && c != '\t' && c != ' ' && c != ',') {
- if (c == '\\')
- c = getc(cfile);
- *cp++ = c;
- }
- }
- *cp = 0;
- if (tokval[0] == 0)
- return (0);
- for (t = toktab; t->tokstr; t++)
- if (!strcmp(t->tokstr, tokval))
- return (t->tval);
- return (ID);
-}
diff --git a/appl/ftp/ftp/security.c b/appl/ftp/ftp/security.c
deleted file mode 100644
index 86c73a168cea..000000000000
--- a/appl/ftp/ftp/security.c
+++ /dev/null
@@ -1,883 +0,0 @@
-/*
- * Copyright (c) 1998-2002, 2005 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the Institute nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifdef FTP_SERVER
-#include "ftpd_locl.h"
-#else
-#include "ftp_locl.h"
-#endif
-
-RCSID("$Id$");
-
-static enum protection_level command_prot;
-static enum protection_level data_prot;
-static size_t buffer_size;
-
-struct buffer {
- void *data;
- size_t size;
- size_t index;
- int eof_flag;
-};
-
-static struct buffer in_buffer, out_buffer;
-int sec_complete;
-
-static struct {
- enum protection_level level;
- const char *name;
-} level_names[] = {
- { prot_clear, "clear" },
- { prot_safe, "safe" },
- { prot_confidential, "confidential" },
- { prot_private, "private" }
-};
-
-static const char *
-level_to_name(enum protection_level level)
-{
- int i;
- for(i = 0; i < sizeof(level_names) / sizeof(level_names[0]); i++)
- if(level_names[i].level == level)
- return level_names[i].name;
- return "unknown";
-}
-
-#ifndef FTP_SERVER /* not used in server */
-static enum protection_level
-name_to_level(const char *name)
-{
- int i;
- for(i = 0; i < sizeof(level_names) / sizeof(level_names[0]); i++)
- if(!strncasecmp(level_names[i].name, name, strlen(name)))
- return level_names[i].level;
- return prot_invalid;
-}
-#endif
-
-#ifdef FTP_SERVER
-
-static struct sec_server_mech *mechs[] = {
-#ifdef KRB5
- &gss_server_mech,
-#endif
- NULL
-};
-
-static struct sec_server_mech *mech;
-
-#else
-
-static struct sec_client_mech *mechs[] = {
-#ifdef KRB5
- &gss_client_mech,
-#endif
- NULL
-};
-
-static struct sec_client_mech *mech;
-
-#endif
-
-static void *app_data;
-
-int
-sec_getc(FILE *F)
-{
- if(sec_complete && data_prot) {
- char c;
- if(sec_read(fileno(F), &c, 1) <= 0)
- return EOF;
- return c;
- } else
- return getc(F);
-}
-
-static int
-block_read(int fd, void *buf, size_t len)
-{
- unsigned char *p = buf;
- int b;
- while(len) {
- b = read(fd, p, len);
- if (b == 0)
- return 0;
- else if (b < 0)
- return -1;
- len -= b;
- p += b;
- }
- return p - (unsigned char*)buf;
-}
-
-static int
-block_write(int fd, void *buf, size_t len)
-{
- unsigned char *p = buf;
- int b;
- while(len) {
- b = write(fd, p, len);
- if(b < 0)
- return -1;
- len -= b;
- p += b;
- }
- return p - (unsigned char*)buf;
-}
-
-static int
-sec_get_data(int fd, struct buffer *buf, int level)
-{
- int len;
- int b;
- void *tmp;
-
- b = block_read(fd, &len, sizeof(len));
- if (b == 0)
- return 0;
- else if (b < 0)
- return -1;
- len = ntohl(len);
- tmp = realloc(buf->data, len);
- if (tmp == NULL)
- return -1;
- buf->data = tmp;
- b = block_read(fd, buf->data, len);
- if (b == 0)
- return 0;
- else if (b < 0)
- return -1;
- buf->size = (*mech->decode)(app_data, buf->data, len, data_prot);
- buf->index = 0;
- return 0;
-}
-
-static size_t
-buffer_read(struct buffer *buf, void *dataptr, size_t len)
-{
- len = min(len, buf->size - buf->index);
- memcpy(dataptr, (char*)buf->data + buf->index, len);
- buf->index += len;
- return len;
-}
-
-static size_t
-buffer_write(struct buffer *buf, void *dataptr, size_t len)
-{
- if(buf->index + len > buf->size) {
- void *tmp;
- if(buf->data == NULL)
- tmp = malloc(1024);
- else
- tmp = realloc(buf->data, buf->index + len);
- if(tmp == NULL)
- return -1;
- buf->data = tmp;
- buf->size = buf->index + len;
- }
- memcpy((char*)buf->data + buf->index, dataptr, len);
- buf->index += len;
- return len;
-}
-
-int
-sec_read(int fd, void *dataptr, int length)
-{
- size_t len;
- int rx = 0;
-
- if(sec_complete == 0 || data_prot == 0)
- return read(fd, dataptr, length);
-
- if(in_buffer.eof_flag){
- in_buffer.eof_flag = 0;
- return 0;
- }
-
- len = buffer_read(&in_buffer, dataptr, length);
- length -= len;
- rx += len;
- dataptr = (char*)dataptr + len;
-
- while(length){
- int ret;
-
- ret = sec_get_data(fd, &in_buffer, data_prot);
- if (ret < 0)
- return -1;
- if(ret == 0 && in_buffer.size == 0) {
- if(rx)
- in_buffer.eof_flag = 1;
- return rx;
- }
- len = buffer_read(&in_buffer, dataptr, length);
- length -= len;
- rx += len;
- dataptr = (char*)dataptr + len;
- }
- return rx;
-}
-
-static int
-sec_send(int fd, char *from, int length)
-{
- int bytes;
- void *buf;
- bytes = (*mech->encode)(app_data, from, length, data_prot, &buf);
- bytes = htonl(bytes);
- block_write(fd, &bytes, sizeof(bytes));
- block_write(fd, buf, ntohl(bytes));
- free(buf);
- return length;
-}
-
-int
-sec_fflush(FILE *F)
-{
- if(data_prot != prot_clear) {
- if(out_buffer.index > 0){
- sec_write(fileno(F), out_buffer.data, out_buffer.index);
- out_buffer.index = 0;
- }
- sec_send(fileno(F), NULL, 0);
- }
- fflush(F);
- return 0;
-}
-
-int
-sec_write(int fd, char *dataptr, int length)
-{
- int len = buffer_size;
- int tx = 0;
-
- if(data_prot == prot_clear)
- return write(fd, dataptr, length);
-
- len -= (*mech->overhead)(app_data, data_prot, len);
- while(length){
- if(length < len)
- len = length;
- sec_send(fd, dataptr, len);
- length -= len;
- dataptr += len;
- tx += len;
- }
- return tx;
-}
-
-int
-sec_vfprintf2(FILE *f, const char *fmt, va_list ap)
-{
- char *buf;
- int ret;
- if(data_prot == prot_clear)
- return vfprintf(f, fmt, ap);
- else {
- int len;
- len = vasprintf(&buf, fmt, ap);
- if (len == -1)
- return len;
- ret = buffer_write(&out_buffer, buf, len);
- free(buf);
- return ret;
- }
-}
-
-int
-sec_fprintf2(FILE *f, const char *fmt, ...)
-{
- int ret;
- va_list ap;
- va_start(ap, fmt);
- ret = sec_vfprintf2(f, fmt, ap);
- va_end(ap);
- return ret;
-}
-
-int
-sec_putc(int c, FILE *F)
-{
- char ch = c;
- if(data_prot == prot_clear)
- return putc(c, F);
-
- buffer_write(&out_buffer, &ch, 1);
- if(c == '\n' || out_buffer.index >= 1024 /* XXX */) {
- sec_write(fileno(F), out_buffer.data, out_buffer.index);
- out_buffer.index = 0;
- }
- return c;
-}
-
-int
-sec_read_msg(char *s, int level)
-{
- int len;
- char *buf;
- int return_code;
-
- buf = malloc(strlen(s));
- len = base64_decode(s + 4, buf); /* XXX */
-
- len = (*mech->decode)(app_data, buf, len, level);
- if(len < 0)
- return -1;
-
- buf[len] = '\0';
-
- if(buf[3] == '-')
- return_code = 0;
- else
- sscanf(buf, "%d", &return_code);
- if(buf[len-1] == '\n')
- buf[len-1] = '\0';
- strcpy(s, buf);
- free(buf);
- return return_code;
-}
-
-int
-sec_vfprintf(FILE *f, const char *fmt, va_list ap)
-{
- char *buf;
- void *enc;
- int len;
- if(!sec_complete)
- return vfprintf(f, fmt, ap);
-
- if (vasprintf(&buf, fmt, ap) == -1) {
- printf("Failed to allocate command.\n");
- return -1;
- }
- len = (*mech->encode)(app_data, buf, strlen(buf), command_prot, &enc);
- free(buf);
- if(len < 0) {
- printf("Failed to encode command.\n");
- return -1;
- }
- if(base64_encode(enc, len, &buf) < 0){
- free(enc);
- printf("Out of memory base64-encoding.\n");
- return -1;
- }
- free(enc);
-#ifdef FTP_SERVER
- if(command_prot == prot_safe)
- fprintf(f, "631 %s\r\n", buf);
- else if(command_prot == prot_private)
- fprintf(f, "632 %s\r\n", buf);
- else if(command_prot == prot_confidential)
- fprintf(f, "633 %s\r\n", buf);
-#else
- if(command_prot == prot_safe)
- fprintf(f, "MIC %s", buf);
- else if(command_prot == prot_private)
- fprintf(f, "ENC %s", buf);
- else if(command_prot == prot_confidential)
- fprintf(f, "CONF %s", buf);
-#endif
- free(buf);
- return 0;
-}
-
-int
-sec_fprintf(FILE *f, const char *fmt, ...)
-{
- va_list ap;
- int ret;
- va_start(ap, fmt);
- ret = sec_vfprintf(f, fmt, ap);
- va_end(ap);
- return ret;
-}
-
-/* end common stuff */
-
-#ifdef FTP_SERVER
-
-int ccc_passed;
-
-void
-auth(char *auth_name)
-{
- int i;
- void *tmp;
-
- for(i = 0; (mech = mechs[i]) != NULL; i++){
- if(!strcasecmp(auth_name, mech->name)){
- tmp = realloc(app_data, mech->size);
- if (tmp == NULL) {
- reply(431, "Unable to accept %s at this time", mech->name);
- return;
- }
- app_data = tmp;
-
- if(mech->init && (*mech->init)(app_data) != 0) {
- reply(431, "Unable to accept %s at this time", mech->name);
- return;
- }
- if(mech->auth) {
- (*mech->auth)(app_data);
- return;
- }
- if(mech->adat)
- reply(334, "Send authorization data.");
- else
- reply(234, "Authorization complete.");
- return;
- }
- }
- free (app_data);
- app_data = NULL;
- reply(504, "%s is unknown to me", auth_name);
-}
-
-void
-adat(char *auth_data)
-{
- if(mech && !sec_complete) {
- void *buf = malloc(strlen(auth_data));
- size_t len;
- len = base64_decode(auth_data, buf);
- (*mech->adat)(app_data, buf, len);
- free(buf);
- } else
- reply(503, "You must %sissue an AUTH first.", mech ? "re-" : "");
-}
-
-void pbsz(int size)
-{
- size_t new = size;
- if(!sec_complete)
- reply(503, "Incomplete security data exchange.");
- if(mech->pbsz)
- new = (*mech->pbsz)(app_data, size);
- if(buffer_size != new){
- buffer_size = size;
- }
- if(new != size)
- reply(200, "PBSZ=%lu", (unsigned long)new);
- else
- reply(200, "OK");
-}
-
-void
-prot(char *pl)
-{
- int p = -1;
-
- if(buffer_size == 0){
- reply(503, "No protection buffer size negotiated.");
- return;
- }
-
- if(!strcasecmp(pl, "C"))
- p = prot_clear;
- else if(!strcasecmp(pl, "S"))
- p = prot_safe;
- else if(!strcasecmp(pl, "E"))
- p = prot_confidential;
- else if(!strcasecmp(pl, "P"))
- p = prot_private;
- else {
- reply(504, "Unrecognized protection level.");
- return;
- }
-
- if(sec_complete){
- if((*mech->check_prot)(app_data, p)){
- reply(536, "%s does not support %s protection.",
- mech->name, level_to_name(p));
- }else{
- data_prot = (enum protection_level)p;
- reply(200, "Data protection is %s.", level_to_name(p));
- }
- }else{
- reply(503, "Incomplete security data exchange.");
- }
-}
-
-void ccc(void)
-{
- if(sec_complete){
- if(mech->ccc && (*mech->ccc)(app_data) == 0) {
- command_prot = data_prot = prot_clear;
- ccc_passed = 1;
- } else
- reply(534, "You must be joking.");
- }else
- reply(503, "Incomplete security data exchange.");
-}
-
-void mec(char *msg, enum protection_level level)
-{
- void *buf;
- size_t len, buf_size;
- if(!sec_complete) {
- reply(503, "Incomplete security data exchange.");
- return;
- }
- buf_size = strlen(msg) + 2;
- buf = malloc(buf_size);
- if (buf == NULL) {
- reply(501, "Failed to allocate %lu", (unsigned long)buf_size);
- return;
- }
- len = base64_decode(msg, buf);
- command_prot = level;
- if(len == (size_t)-1) {
- free(buf);
- reply(501, "Failed to base64-decode command");
- return;
- }
- len = (*mech->decode)(app_data, buf, len, level);
- if(len == (size_t)-1) {
- free(buf);
- reply(535, "Failed to decode command");
- return;
- }
- ((char*)buf)[len] = '\0';
- if(strstr((char*)buf, "\r\n") == NULL)
- strlcat((char*)buf, "\r\n", buf_size);
- new_ftp_command(buf);
-}
-
-/* ------------------------------------------------------------ */
-
-int
-sec_userok(char *userstr)
-{
- if(sec_complete)
- return (*mech->userok)(app_data, userstr);
- return 0;
-}
-
-int
-sec_session(char *user)
-{
- if(sec_complete && mech->session)
- return (*mech->session)(app_data, user);
- return 0;
-}
-
-char *ftp_command;
-
-void
-new_ftp_command(char *command)
-{
- ftp_command = command;
-}
-
-void
-delete_ftp_command(void)
-{
- free(ftp_command);
- ftp_command = NULL;
-}
-
-int
-secure_command(void)
-{
- return ftp_command != NULL;
-}
-
-enum protection_level
-get_command_prot(void)
-{
- return command_prot;
-}
-
-#else /* FTP_SERVER */
-
-void
-sec_status(void)
-{
- if(sec_complete){
- printf("Using %s for authentication.\n", mech->name);
- printf("Using %s command channel.\n", level_to_name(command_prot));
- printf("Using %s data channel.\n", level_to_name(data_prot));
- if(buffer_size > 0)
- printf("Protection buffer size: %lu.\n",
- (unsigned long)buffer_size);
- }else{
- printf("Not using any security mechanism.\n");
- }
-}
-
-static int
-sec_prot_internal(int level)
-{
- int ret;
- char *p;
- unsigned int s = 1048576;
-
- int old_verbose = verbose;
- verbose = 0;
-
- if(!sec_complete){
- printf("No security data exchange has taken place.\n");
- return -1;
- }
-
- if(level){
- ret = command("PBSZ %u", s);
- if(ret != COMPLETE){
- printf("Failed to set protection buffer size.\n");
- return -1;
- }
- buffer_size = s;
- p = strstr(reply_string, "PBSZ=");
- if(p)
- sscanf(p, "PBSZ=%u", &s);
- if(s < buffer_size)
- buffer_size = s;
- }
- verbose = old_verbose;
- ret = command("PROT %c", level["CSEP"]); /* XXX :-) */
- if(ret != COMPLETE){
- printf("Failed to set protection level.\n");
- return -1;
- }
-
- data_prot = (enum protection_level)level;
- return 0;
-}
-
-enum protection_level
-set_command_prot(enum protection_level level)
-{
- int ret;
- enum protection_level old = command_prot;
- if(level != command_prot && level == prot_clear) {
- ret = command("CCC");
- if(ret != COMPLETE) {
- printf("Failed to clear command channel.\n");
- return prot_invalid;
- }
- }
- command_prot = level;
- return old;
-}
-
-void
-sec_prot(int argc, char **argv)
-{
- int level = -1;
-
- if(argc > 3)
- goto usage;
-
- if(argc == 1) {
- sec_status();
- return;
- }
- if(!sec_complete) {
- printf("No security data exchange has taken place.\n");
- code = -1;
- return;
- }
- level = name_to_level(argv[argc - 1]);
-
- if(level == -1)
- goto usage;
-
- if((*mech->check_prot)(app_data, level)) {
- printf("%s does not implement %s protection.\n",
- mech->name, level_to_name(level));
- code = -1;
- return;
- }
-
- if(argc == 2 || strncasecmp(argv[1], "data", strlen(argv[1])) == 0) {
- if(sec_prot_internal(level) < 0){
- code = -1;
- return;
- }
- } else if(strncasecmp(argv[1], "command", strlen(argv[1])) == 0) {
- if(set_command_prot(level) < 0) {
- code = -1;
- return;
- }
- } else
- goto usage;
- code = 0;
- return;
- usage:
- printf("usage: %s [command|data] [clear|safe|confidential|private]\n",
- argv[0]);
- code = -1;
-}
-
-void
-sec_prot_command(int argc, char **argv)
-{
- int level;
-
- if(argc > 2)
- goto usage;
-
- if(!sec_complete) {
- printf("No security data exchange has taken place.\n");
- code = -1;
- return;
- }
-
- if(argc == 1) {
- sec_status();
- } else {
- level = name_to_level(argv[1]);
- if(level == -1)
- goto usage;
-
- if((*mech->check_prot)(app_data, level)) {
- printf("%s does not implement %s protection.\n",
- mech->name, level_to_name(level));
- code = -1;
- return;
- }
- if(set_command_prot(level) < 0) {
- code = -1;
- return;
- }
- }
- code = 0;
- return;
- usage:
- printf("usage: %s [clear|safe|confidential|private]\n",
- argv[0]);
- code = -1;
-}
-
-static enum protection_level request_data_prot;
-
-void
-sec_set_protection_level(void)
-{
- if(sec_complete && data_prot != request_data_prot)
- sec_prot_internal(request_data_prot);
-}
-
-
-int
-sec_request_prot(char *level)
-{
- int l = name_to_level(level);
- if(l == -1)
- return -1;
- request_data_prot = (enum protection_level)l;
- return 0;
-}
-
-int
-sec_login(char *host)
-{
- int ret;
- struct sec_client_mech **m;
- int old_verbose = verbose;
-
- verbose = -1; /* shut up all messages this will produce (they
- are usually not very user friendly) */
-
- for(m = mechs; *m && (*m)->name; m++) {
- void *tmp;
-
- tmp = realloc(app_data, (*m)->size);
- if (tmp == NULL) {
- warnx ("realloc %lu failed", (unsigned long)(*m)->size);
- return -1;
- }
- app_data = tmp;
-
- if((*m)->init && (*(*m)->init)(app_data) != 0) {
- printf("Skipping %s...\n", (*m)->name);
- continue;
- }
- printf("Trying %s...\n", (*m)->name);
- ret = command("AUTH %s", (*m)->name);
- if(ret != CONTINUE){
- if(code == 504){
- printf("%s is not supported by the server.\n", (*m)->name);
- }else if(code == 534){
- printf("%s rejected as security mechanism.\n", (*m)->name);
- }else if(ret == ERROR) {
- printf("The server doesn't support the FTP "
- "security extensions.\n");
- verbose = old_verbose;
- return -1;
- }
- continue;
- }
-
- ret = (*(*m)->auth)(app_data, host);
-
- if(ret == AUTH_CONTINUE)
- continue;
- else if(ret != AUTH_OK){
- /* mechanism is supposed to output error string */
- verbose = old_verbose;
- return -1;
- }
- mech = *m;
- sec_complete = 1;
- if(doencrypt) {
- command_prot = prot_private;
- request_data_prot = prot_private;
- } else {
- command_prot = prot_safe;
- }
- break;
- }
-
- verbose = old_verbose;
- return *m == NULL;
-}
-
-void
-sec_end(void)
-{
- if (mech != NULL) {
- if(mech->end)
- (*mech->end)(app_data);
- if (app_data != NULL) {
- memset(app_data, 0, mech->size);
- free(app_data);
- app_data = NULL;
- }
- }
- sec_complete = 0;
- data_prot = (enum protection_level)0;
-}
-
-#endif /* FTP_SERVER */
-
diff --git a/appl/ftp/ftp/security.h b/appl/ftp/ftp/security.h
deleted file mode 100644
index 553372e28bf4..000000000000
--- a/appl/ftp/ftp/security.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright (c) 1998 - 2005 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the Institute nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/* $Id$ */
-
-#ifndef __security_h__
-#define __security_h__
-
-enum protection_level {
- prot_invalid = -1,
- prot_clear = 0,
- prot_safe = 1,
- prot_confidential = 2,
- prot_private = 3
-};
-
-struct sec_client_mech {
- char *name;
- size_t size;
- int (*init)(void *);
- int (*auth)(void *, char*);
- void (*end)(void *);
- int (*check_prot)(void *, int);
- int (*overhead)(void *, int, int);
- int (*encode)(void *, void*, int, int, void**);
- int (*decode)(void *, void*, int, int);
-};
-
-struct sec_server_mech {
- char *name;
- size_t size;
- int (*init)(void *);
- void (*end)(void *);
- int (*check_prot)(void *, int);
- int (*overhead)(void *, int, int);
- int (*encode)(void *, void*, int, int, void**);
- int (*decode)(void *, void*, int, int);
-
- int (*auth)(void *);
- int (*adat)(void *, void*, size_t);
- size_t (*pbsz)(void *, size_t);
- int (*ccc)(void*);
- int (*userok)(void*, char*);
- int (*session)(void*, char*);
-};
-
-#define AUTH_OK 0
-#define AUTH_CONTINUE 1
-#define AUTH_ERROR 2
-
-extern int ftp_do_gss_bindings;
-extern int ftp_do_gss_delegate;
-#ifdef FTP_SERVER
-extern struct sec_server_mech krb4_server_mech, gss_server_mech;
-#else
-extern struct sec_client_mech krb4_client_mech, gss_client_mech;
-#endif
-
-extern int sec_complete;
-
-#ifdef FTP_SERVER
-extern char *ftp_command;
-void new_ftp_command(char*);
-void delete_ftp_command(void);
-#endif
-
-/* ---- */
-
-
-int sec_fflush (FILE *);
-int sec_fprintf (FILE *, const char *, ...)
- __attribute__ ((format (printf, 2,3)));
-int sec_getc (FILE *);
-int sec_putc (int, FILE *);
-int sec_read (int, void *, int);
-int sec_read_msg (char *, int);
-int sec_vfprintf (FILE *, const char *, va_list)
- __attribute__ ((format (printf, 2,0)));
-int sec_fprintf2(FILE *f, const char *fmt, ...)
- __attribute__ ((format (printf, 2,3)));
-int sec_vfprintf2(FILE *, const char *, va_list)
- __attribute__ ((format (printf, 2,0)));
-int sec_write (int, char *, int);
-
-#ifdef FTP_SERVER
-void adat (char *);
-void auth (char *);
-void ccc (void);
-void mec (char *, enum protection_level);
-void pbsz (int);
-void prot (char *);
-void delete_ftp_command (void);
-void new_ftp_command (char *);
-int sec_userok (char *);
-int sec_session(char *);
-int secure_command (void);
-enum protection_level get_command_prot(void);
-#else
-void sec_end (void);
-int sec_login (char *);
-void sec_prot (int, char **);
-void sec_prot_command (int, char **);
-int sec_request_prot (char *);
-void sec_set_protection_level (void);
-void sec_status (void);
-
-enum protection_level set_command_prot(enum protection_level);
-
-#endif
-
-#endif /* __security_h__ */
diff --git a/appl/ftp/ftpd/Makefile.am b/appl/ftp/ftpd/Makefile.am
deleted file mode 100644
index 355b8baae4e2..000000000000
--- a/appl/ftp/ftpd/Makefile.am
+++ /dev/null
@@ -1,54 +0,0 @@
-# $Id$
-
-include $(top_srcdir)/Makefile.am.common
-
-AM_CPPFLAGS += -I$(srcdir)/../common $(INCLUDE_krb4) -DFTP_SERVER
-
-libexec_PROGRAMS = ftpd
-
-CHECK_LOCAL =
-
-if KRB5
-krb5_sources = gssapi.c gss_userok.c
-endif
-
-ftpd_SOURCES = \
- extern.h \
- ftpcmd.y \
- ftpd.c \
- ftpd_locl.h \
- logwtmp.c \
- ls.c \
- pathnames.h \
- popen.c \
- security.c \
- kauth.c \
- klist.c \
- $(krb4_sources) \
- $(krb5_sources)
-
-EXTRA_ftpd_SOURCES = kauth.c gssapi.c gss_userok.c
-
-$(ftpd_OBJECTS): security.h
-
-security.c:
- @test -f security.c || $(LN_S) $(srcdir)/../ftp/security.c .
-security.h:
- @test -f security.h || $(LN_S) $(srcdir)/../ftp/security.h .
-gssapi.c:
- @test -f gssapi.c || $(LN_S) $(srcdir)/../ftp/gssapi.c .
-
-CLEANFILES = security.c security.h gssapi.c
-
-man_MANS = ftpd.8 ftpusers.5
-
-LDADD = ../common/libcommon.a \
- $(LIB_otp) \
- $(LIB_gssapi) \
- $(LIB_krb5) \
- $(LIB_kafs) \
- $(LIB_krb4) \
- $(LIB_hcrypto) \
- $(LIB_roken)
-
-EXTRA_DIST = NTMakefile $(man_MANS)
diff --git a/appl/ftp/ftpd/Makefile.in b/appl/ftp/ftpd/Makefile.in
deleted file mode 100644
index afa961539a33..000000000000
--- a/appl/ftp/ftpd/Makefile.in
+++ /dev/null
@@ -1,1055 +0,0 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-@SET_MAKE@
-
-# $Id$
-
-# $Id$
-
-# $Id$
-
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
- $(top_srcdir)/Makefile.am.common \
- $(top_srcdir)/cf/Makefile.am.common ftpcmd.c
-libexec_PROGRAMS = ftpd$(EXEEXT)
-subdir = appl/ftp/ftpd
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/cf/aix.m4 \
- $(top_srcdir)/cf/auth-modules.m4 \
- $(top_srcdir)/cf/broken-getaddrinfo.m4 \
- $(top_srcdir)/cf/broken-glob.m4 \
- $(top_srcdir)/cf/broken-realloc.m4 \
- $(top_srcdir)/cf/broken-snprintf.m4 $(top_srcdir)/cf/broken.m4 \
- $(top_srcdir)/cf/broken2.m4 $(top_srcdir)/cf/c-attribute.m4 \
- $(top_srcdir)/cf/capabilities.m4 \
- $(top_srcdir)/cf/check-compile-et.m4 \
- $(top_srcdir)/cf/check-getpwnam_r-posix.m4 \
- $(top_srcdir)/cf/check-man.m4 \
- $(top_srcdir)/cf/check-netinet-ip-and-tcp.m4 \
- $(top_srcdir)/cf/check-type-extra.m4 \
- $(top_srcdir)/cf/check-var.m4 $(top_srcdir)/cf/check-x.m4 \
- $(top_srcdir)/cf/check-xau.m4 $(top_srcdir)/cf/crypto.m4 \
- $(top_srcdir)/cf/db.m4 $(top_srcdir)/cf/destdirs.m4 \
- $(top_srcdir)/cf/dispatch.m4 $(top_srcdir)/cf/dlopen.m4 \
- $(top_srcdir)/cf/find-func-no-libs.m4 \
- $(top_srcdir)/cf/find-func-no-libs2.m4 \
- $(top_srcdir)/cf/find-func.m4 \
- $(top_srcdir)/cf/find-if-not-broken.m4 \
- $(top_srcdir)/cf/framework-security.m4 \
- $(top_srcdir)/cf/have-struct-field.m4 \
- $(top_srcdir)/cf/have-type.m4 $(top_srcdir)/cf/irix.m4 \
- $(top_srcdir)/cf/krb-bigendian.m4 \
- $(top_srcdir)/cf/krb-func-getlogin.m4 \
- $(top_srcdir)/cf/krb-ipv6.m4 $(top_srcdir)/cf/krb-prog-ln-s.m4 \
- $(top_srcdir)/cf/krb-readline.m4 \
- $(top_srcdir)/cf/krb-struct-spwd.m4 \
- $(top_srcdir)/cf/krb-struct-winsize.m4 \
- $(top_srcdir)/cf/largefile.m4 $(top_srcdir)/cf/libtool.m4 \
- $(top_srcdir)/cf/ltoptions.m4 $(top_srcdir)/cf/ltsugar.m4 \
- $(top_srcdir)/cf/ltversion.m4 $(top_srcdir)/cf/lt~obsolete.m4 \
- $(top_srcdir)/cf/mips-abi.m4 $(top_srcdir)/cf/misc.m4 \
- $(top_srcdir)/cf/need-proto.m4 $(top_srcdir)/cf/osfc2.m4 \
- $(top_srcdir)/cf/otp.m4 $(top_srcdir)/cf/pkg.m4 \
- $(top_srcdir)/cf/proto-compat.m4 $(top_srcdir)/cf/pthreads.m4 \
- $(top_srcdir)/cf/resolv.m4 $(top_srcdir)/cf/retsigtype.m4 \
- $(top_srcdir)/cf/roken-frag.m4 \
- $(top_srcdir)/cf/socket-wrapper.m4 $(top_srcdir)/cf/sunos.m4 \
- $(top_srcdir)/cf/telnet.m4 $(top_srcdir)/cf/test-package.m4 \
- $(top_srcdir)/cf/version-script.m4 $(top_srcdir)/cf/wflags.m4 \
- $(top_srcdir)/cf/win32.m4 $(top_srcdir)/cf/with-all.m4 \
- $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
- $(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/include/config.h
-CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
-am__installdirs = "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(man5dir)" \
- "$(DESTDIR)$(man8dir)"
-PROGRAMS = $(libexec_PROGRAMS)
-am__ftpd_SOURCES_DIST = extern.h ftpcmd.y ftpd.c ftpd_locl.h logwtmp.c \
- ls.c pathnames.h popen.c security.c kauth.c klist.c gssapi.c \
- gss_userok.c
-@KRB5_TRUE@am__objects_1 = gssapi.$(OBJEXT) gss_userok.$(OBJEXT)
-am_ftpd_OBJECTS = ftpcmd.$(OBJEXT) ftpd.$(OBJEXT) logwtmp.$(OBJEXT) \
- ls.$(OBJEXT) popen.$(OBJEXT) security.$(OBJEXT) \
- kauth.$(OBJEXT) klist.$(OBJEXT) $(am__objects_1)
-ftpd_OBJECTS = $(am_ftpd_OBJECTS)
-ftpd_LDADD = $(LDADD)
-am__DEPENDENCIES_1 =
-am__DEPENDENCIES_2 = $(top_builddir)/lib/kafs/libkafs.la \
- $(am__DEPENDENCIES_1)
-ftpd_DEPENDENCIES = ../common/libcommon.a $(am__DEPENDENCIES_1) \
- $(LIB_gssapi) $(LIB_krb5) $(am__DEPENDENCIES_2) \
- $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_1)
-depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
-am__mv = mv -f
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
-@MAINTAINER_MODE_FALSE@am__skipyacc = test -f $@ ||
-YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS)
-LTYACCCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(YACC) $(YFLAGS) $(AM_YFLAGS)
-YLWRAP = $(top_srcdir)/ylwrap
-SOURCES = $(ftpd_SOURCES) $(EXTRA_ftpd_SOURCES)
-DIST_SOURCES = $(am__ftpd_SOURCES_DIST) $(EXTRA_ftpd_SOURCES)
-am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
-am__vpath_adj = case $$p in \
- $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
- *) f=$$p;; \
- esac;
-am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
-am__install_max = 40
-am__nobase_strip_setup = \
- srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
-am__nobase_strip = \
- for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
-am__nobase_list = $(am__nobase_strip_setup); \
- for p in $$list; do echo "$$p $$p"; done | \
- sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
- $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
- if (++n[$$2] == $(am__install_max)) \
- { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
- END { for (dir in files) print dir, files[dir] }'
-am__base_list = \
- sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
- sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-man5dir = $(mandir)/man5
-man8dir = $(mandir)/man8
-MANS = $(man_MANS)
-ETAGS = etags
-CTAGS = ctags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AIX_EXTRA_KAFS = @AIX_EXTRA_KAFS@
-AMTAR = @AMTAR@
-AR = @AR@
-ASN1_COMPILE = @ASN1_COMPILE@
-ASN1_COMPILE_DEP = @ASN1_COMPILE_DEP@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CANONICAL_HOST = @CANONICAL_HOST@
-CAPNG_CFLAGS = @CAPNG_CFLAGS@
-CAPNG_LIBS = @CAPNG_LIBS@
-CATMAN = @CATMAN@
-CATMANEXT = @CATMANEXT@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-COMPILE_ET = @COMPILE_ET@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DBHEADER = @DBHEADER@
-DBLIB = @DBLIB@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DIR_com_err = @DIR_com_err@
-DIR_hcrypto = @DIR_hcrypto@
-DIR_hdbdir = @DIR_hdbdir@
-DIR_roken = @DIR_roken@
-DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-FGREP = @FGREP@
-GREP = @GREP@
-GROFF = @GROFF@
-INCLUDES_roken = @INCLUDES_roken@
-INCLUDE_hcrypto = @INCLUDE_hcrypto@
-INCLUDE_hesiod = @INCLUDE_hesiod@
-INCLUDE_krb4 = @INCLUDE_krb4@
-INCLUDE_libedit = @INCLUDE_libedit@
-INCLUDE_libintl = @INCLUDE_libintl@
-INCLUDE_openldap = @INCLUDE_openldap@
-INCLUDE_readline = @INCLUDE_readline@
-INCLUDE_sqlite3 = @INCLUDE_sqlite3@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LDFLAGS_VERSION_SCRIPT = @LDFLAGS_VERSION_SCRIPT@
-LEX = @LEX@
-LEXLIB = @LEXLIB@
-LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
-LIBADD_roken = @LIBADD_roken@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIB_AUTH_SUBDIRS = @LIB_AUTH_SUBDIRS@
-LIB_NDBM = @LIB_NDBM@
-LIB_XauFileName = @LIB_XauFileName@
-LIB_XauReadAuth = @LIB_XauReadAuth@
-LIB_XauWriteAuth = @LIB_XauWriteAuth@
-LIB_bswap16 = @LIB_bswap16@
-LIB_bswap32 = @LIB_bswap32@
-LIB_com_err = @LIB_com_err@
-LIB_com_err_a = @LIB_com_err_a@
-LIB_com_err_so = @LIB_com_err_so@
-LIB_crypt = @LIB_crypt@
-LIB_db_create = @LIB_db_create@
-LIB_dbm_firstkey = @LIB_dbm_firstkey@
-LIB_dbopen = @LIB_dbopen@
-LIB_dispatch_async_f = @LIB_dispatch_async_f@
-LIB_dlopen = @LIB_dlopen@
-LIB_dn_expand = @LIB_dn_expand@
-LIB_dns_search = @LIB_dns_search@
-LIB_door_create = @LIB_door_create@
-LIB_freeaddrinfo = @LIB_freeaddrinfo@
-LIB_gai_strerror = @LIB_gai_strerror@
-LIB_getaddrinfo = @LIB_getaddrinfo@
-LIB_gethostbyname = @LIB_gethostbyname@
-LIB_gethostbyname2 = @LIB_gethostbyname2@
-LIB_getnameinfo = @LIB_getnameinfo@
-LIB_getpwnam_r = @LIB_getpwnam_r@
-LIB_getsockopt = @LIB_getsockopt@
-LIB_hcrypto = @LIB_hcrypto@
-LIB_hcrypto_a = @LIB_hcrypto_a@
-LIB_hcrypto_appl = @LIB_hcrypto_appl@
-LIB_hcrypto_so = @LIB_hcrypto_so@
-LIB_hesiod = @LIB_hesiod@
-LIB_hstrerror = @LIB_hstrerror@
-LIB_kdb = @LIB_kdb@
-LIB_krb4 = @LIB_krb4@
-LIB_libedit = @LIB_libedit@
-LIB_libintl = @LIB_libintl@
-LIB_loadquery = @LIB_loadquery@
-LIB_logout = @LIB_logout@
-LIB_logwtmp = @LIB_logwtmp@
-LIB_openldap = @LIB_openldap@
-LIB_openpty = @LIB_openpty@
-LIB_otp = @LIB_otp@
-LIB_pidfile = @LIB_pidfile@
-LIB_readline = @LIB_readline@
-LIB_res_ndestroy = @LIB_res_ndestroy@
-LIB_res_nsearch = @LIB_res_nsearch@
-LIB_res_search = @LIB_res_search@
-LIB_roken = @LIB_roken@
-LIB_security = @LIB_security@
-LIB_setsockopt = @LIB_setsockopt@
-LIB_socket = @LIB_socket@
-LIB_sqlite3 = @LIB_sqlite3@
-LIB_syslog = @LIB_syslog@
-LIB_tgetent = @LIB_tgetent@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
-NO_AFS = @NO_AFS@
-NROFF = @NROFF@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PKG_CONFIG = @PKG_CONFIG@
-PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
-PTHREAD_LDADD = @PTHREAD_LDADD@
-PTHREAD_LIBADD = @PTHREAD_LIBADD@
-RANLIB = @RANLIB@
-SED = @SED@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-SLC = @SLC@
-SLC_DEP = @SLC_DEP@
-STRIP = @STRIP@
-VERSION = @VERSION@
-VERSIONING = @VERSIONING@
-WFLAGS = @WFLAGS@
-WFLAGS_NOIMPLICITINT = @WFLAGS_NOIMPLICITINT@
-WFLAGS_NOUNUSED = @WFLAGS_NOUNUSED@
-XMKMF = @XMKMF@
-X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
-X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
-YACC = @YACC@
-YFLAGS = @YFLAGS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dpagaix_cflags = @dpagaix_cflags@
-dpagaix_ldadd = @dpagaix_ldadd@
-dpagaix_ldflags = @dpagaix_ldflags@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-subdirs = @subdirs@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-SUFFIXES = .et .h .x .z .hx .1 .3 .5 .8 .cat1 .cat3 .cat5 .cat8
-DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_srcdir)/include
-AM_CPPFLAGS = $(INCLUDES_roken) -I$(srcdir)/../common $(INCLUDE_krb4) \
- -DFTP_SERVER
-@do_roken_rename_TRUE@ROKEN_RENAME = -DROKEN_RENAME
-AM_CFLAGS = $(WFLAGS)
-CP = cp
-buildinclude = $(top_builddir)/include
-LIB_el_init = @LIB_el_init@
-LIB_getattr = @LIB_getattr@
-LIB_getpwent_r = @LIB_getpwent_r@
-LIB_odm_initialize = @LIB_odm_initialize@
-LIB_setpcred = @LIB_setpcred@
-HESIODLIB = @HESIODLIB@
-HESIODINCLUDE = @HESIODINCLUDE@
-libexec_heimdaldir = $(libexecdir)/heimdal
-NROFF_MAN = groff -mandoc -Tascii
-LIB_kafs = $(top_builddir)/lib/kafs/libkafs.la $(AIX_EXTRA_KAFS)
-@KRB5_TRUE@LIB_krb5 = $(top_builddir)/lib/krb5/libkrb5.la \
-@KRB5_TRUE@ $(top_builddir)/lib/asn1/libasn1.la
-
-@KRB5_TRUE@LIB_gssapi = $(top_builddir)/lib/gssapi/libgssapi.la
-LIB_heimbase = $(top_builddir)/base/libheimbase.la
-@DCE_TRUE@LIB_kdfs = $(top_builddir)/lib/kdfs/libkdfs.la
-CHECK_LOCAL =
-@KRB5_TRUE@krb5_sources = gssapi.c gss_userok.c
-ftpd_SOURCES = \
- extern.h \
- ftpcmd.y \
- ftpd.c \
- ftpd_locl.h \
- logwtmp.c \
- ls.c \
- pathnames.h \
- popen.c \
- security.c \
- kauth.c \
- klist.c \
- $(krb4_sources) \
- $(krb5_sources)
-
-EXTRA_ftpd_SOURCES = kauth.c gssapi.c gss_userok.c
-CLEANFILES = security.c security.h gssapi.c
-man_MANS = ftpd.8 ftpusers.5
-LDADD = ../common/libcommon.a \
- $(LIB_otp) \
- $(LIB_gssapi) \
- $(LIB_krb5) \
- $(LIB_kafs) \
- $(LIB_krb4) \
- $(LIB_hcrypto) \
- $(LIB_roken)
-
-EXTRA_DIST = NTMakefile $(man_MANS)
-all: all-am
-
-.SUFFIXES:
-.SUFFIXES: .et .h .x .z .hx .1 .3 .5 .8 .cat1 .cat3 .cat5 .cat8 .c .lo .o .obj .y
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.am.common $(top_srcdir)/cf/Makefile.am.common $(am__configure_deps)
- @for dep in $?; do \
- case '$(am__configure_deps)' in \
- *$$dep*) \
- ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
- && { if test -f $@; then exit 0; else break; fi; }; \
- exit 1;; \
- esac; \
- done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign appl/ftp/ftpd/Makefile'; \
- $(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --foreign appl/ftp/ftpd/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- @case '$?' in \
- *config.status*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
- *) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
- esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
-install-libexecPROGRAMS: $(libexec_PROGRAMS)
- @$(NORMAL_INSTALL)
- test -z "$(libexecdir)" || $(MKDIR_P) "$(DESTDIR)$(libexecdir)"
- @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \
- for p in $$list; do echo "$$p $$p"; done | \
- sed 's/$(EXEEXT)$$//' | \
- while read p p1; do if test -f $$p || test -f $$p1; \
- then echo "$$p"; echo "$$p"; else :; fi; \
- done | \
- sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
- -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
- sed 'N;N;N;s,\n, ,g' | \
- $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
- { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
- if ($$2 == $$4) files[d] = files[d] " " $$1; \
- else { print "f", $$3 "/" $$4, $$1; } } \
- END { for (d in files) print "f", d, files[d] }' | \
- while read type dir files; do \
- if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
- test -z "$$files" || { \
- echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(libexecdir)$$dir'"; \
- $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(libexecdir)$$dir" || exit $$?; \
- } \
- ; done
-
-uninstall-libexecPROGRAMS:
- @$(NORMAL_UNINSTALL)
- @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \
- files=`for p in $$list; do echo "$$p"; done | \
- sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
- -e 's/$$/$(EXEEXT)/' `; \
- test -n "$$list" || exit 0; \
- echo " ( cd '$(DESTDIR)$(libexecdir)' && rm -f" $$files ")"; \
- cd "$(DESTDIR)$(libexecdir)" && rm -f $$files
-
-clean-libexecPROGRAMS:
- @list='$(libexec_PROGRAMS)'; test -n "$$list" || exit 0; \
- echo " rm -f" $$list; \
- rm -f $$list || exit $$?; \
- test -n "$(EXEEXT)" || exit 0; \
- list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
- echo " rm -f" $$list; \
- rm -f $$list
-ftpd$(EXEEXT): $(ftpd_OBJECTS) $(ftpd_DEPENDENCIES)
- @rm -f ftpd$(EXEEXT)
- $(LINK) $(ftpd_OBJECTS) $(ftpd_LDADD) $(LIBS)
-
-mostlyclean-compile:
- -rm -f *.$(OBJEXT)
-
-distclean-compile:
- -rm -f *.tab.c
-
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftpcmd.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftpd.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gss_userok.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gssapi.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kauth.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/klist.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/logwtmp.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ls.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/popen.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/security.Po@am__quote@
-
-.c.o:
-@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c $<
-
-.c.obj:
-@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
-
-.c.lo:
-@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
-
-.y.c:
- $(am__skipyacc) $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h $*.h y.output $*.output -- $(YACCCOMPILE)
-
-mostlyclean-libtool:
- -rm -f *.lo
-
-clean-libtool:
- -rm -rf .libs _libs
-install-man5: $(man_MANS)
- @$(NORMAL_INSTALL)
- test -z "$(man5dir)" || $(MKDIR_P) "$(DESTDIR)$(man5dir)"
- @list=''; test -n "$(man5dir)" || exit 0; \
- { for i in $$list; do echo "$$i"; done; \
- l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
- sed -n '/\.5[a-z]*$$/p'; \
- } | while read p; do \
- if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
- echo "$$d$$p"; echo "$$p"; \
- done | \
- sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \
- -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
- sed 'N;N;s,\n, ,g' | { \
- list=; while read file base inst; do \
- if test "$$base" = "$$inst"; then list="$$list $$file"; else \
- echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man5dir)/$$inst'"; \
- $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man5dir)/$$inst" || exit $$?; \
- fi; \
- done; \
- for i in $$list; do echo "$$i"; done | $(am__base_list) | \
- while read files; do \
- test -z "$$files" || { \
- echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man5dir)'"; \
- $(INSTALL_DATA) $$files "$(DESTDIR)$(man5dir)" || exit $$?; }; \
- done; }
-
-uninstall-man5:
- @$(NORMAL_UNINSTALL)
- @list=''; test -n "$(man5dir)" || exit 0; \
- files=`{ for i in $$list; do echo "$$i"; done; \
- l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
- sed -n '/\.5[a-z]*$$/p'; \
- } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \
- -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
- test -z "$$files" || { \
- echo " ( cd '$(DESTDIR)$(man5dir)' && rm -f" $$files ")"; \
- cd "$(DESTDIR)$(man5dir)" && rm -f $$files; }
-install-man8: $(man_MANS)
- @$(NORMAL_INSTALL)
- test -z "$(man8dir)" || $(MKDIR_P) "$(DESTDIR)$(man8dir)"
- @list=''; test -n "$(man8dir)" || exit 0; \
- { for i in $$list; do echo "$$i"; done; \
- l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
- sed -n '/\.8[a-z]*$$/p'; \
- } | while read p; do \
- if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
- echo "$$d$$p"; echo "$$p"; \
- done | \
- sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \
- -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
- sed 'N;N;s,\n, ,g' | { \
- list=; while read file base inst; do \
- if test "$$base" = "$$inst"; then list="$$list $$file"; else \
- echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \
- $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \
- fi; \
- done; \
- for i in $$list; do echo "$$i"; done | $(am__base_list) | \
- while read files; do \
- test -z "$$files" || { \
- echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man8dir)'"; \
- $(INSTALL_DATA) $$files "$(DESTDIR)$(man8dir)" || exit $$?; }; \
- done; }
-
-uninstall-man8:
- @$(NORMAL_UNINSTALL)
- @list=''; test -n "$(man8dir)" || exit 0; \
- files=`{ for i in $$list; do echo "$$i"; done; \
- l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
- sed -n '/\.8[a-z]*$$/p'; \
- } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \
- -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
- test -z "$$files" || { \
- echo " ( cd '$(DESTDIR)$(man8dir)' && rm -f" $$files ")"; \
- cd "$(DESTDIR)$(man8dir)" && rm -f $$files; }
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- mkid -fID $$unique
-tags: TAGS
-
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- set x; \
- here=`pwd`; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- shift; \
- if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- if test $$# -gt 0; then \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- "$$@" $$unique; \
- else \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$unique; \
- fi; \
- fi
-ctags: CTAGS
-CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$unique" \
- || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$unique
-
-GTAGS:
- here=`$(am__cd) $(top_builddir) && pwd` \
- && $(am__cd) $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) "$$here"
-
-distclean-tags:
- -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
- @list='$(MANS)'; if test -n "$$list"; then \
- list=`for p in $$list; do \
- if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
- if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
- if test -n "$$list" && \
- grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
- echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \
- grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \
- echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \
- echo " typically \`make maintainer-clean' will remove them" >&2; \
- exit 1; \
- else :; fi; \
- else :; fi
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
- if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
- if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d "$(distdir)/$$file"; then \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
- if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
- cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
- else \
- test -f "$(distdir)/$$file" \
- || cp -p $$d/$$file "$(distdir)/$$file" \
- || exit 1; \
- fi; \
- done
- $(MAKE) $(AM_MAKEFLAGS) \
- top_distdir="$(top_distdir)" distdir="$(distdir)" \
- dist-hook
-check-am: all-am
- $(MAKE) $(AM_MAKEFLAGS) check-local
-check: check-am
-all-am: Makefile $(PROGRAMS) $(MANS) all-local
-installdirs:
- for dir in "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man8dir)"; do \
- test -z "$$dir" || $(MKDIR_P) "$$dir"; \
- done
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-clean-generic:
- -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
-
-distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
- -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-
-maintainer-clean-generic:
- @echo "This command is intended for maintainers to use"
- @echo "it deletes files that may require special tools to rebuild."
- -rm -f ftpcmd.c
-clean: clean-am
-
-clean-am: clean-generic clean-libexecPROGRAMS clean-libtool \
- mostlyclean-am
-
-distclean: distclean-am
- -rm -rf ./$(DEPDIR)
- -rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
- distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-html-am:
-
-info: info-am
-
-info-am:
-
-install-data-am: install-man
- @$(NORMAL_INSTALL)
- $(MAKE) $(AM_MAKEFLAGS) install-data-hook
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
-install-exec-am: install-libexecPROGRAMS
- @$(NORMAL_INSTALL)
- $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
-install-html: install-html-am
-
-install-html-am:
-
-install-info: install-info-am
-
-install-info-am:
-
-install-man: install-man5 install-man8
-
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
- -rm -rf ./$(DEPDIR)
- -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
- mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am: uninstall-libexecPROGRAMS uninstall-man
- @$(NORMAL_INSTALL)
- $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
-uninstall-man: uninstall-man5 uninstall-man8
-
-.MAKE: check-am install-am install-data-am install-exec-am \
- install-strip uninstall-am
-
-.PHONY: CTAGS GTAGS all all-am all-local check check-am check-local \
- clean clean-generic clean-libexecPROGRAMS clean-libtool ctags \
- dist-hook distclean distclean-compile distclean-generic \
- distclean-libtool distclean-tags distdir dvi dvi-am html \
- html-am info info-am install install-am install-data \
- install-data-am install-data-hook install-dvi install-dvi-am \
- install-exec install-exec-am install-exec-hook install-html \
- install-html-am install-info install-info-am \
- install-libexecPROGRAMS install-man install-man5 install-man8 \
- install-pdf install-pdf-am install-ps install-ps-am \
- install-strip installcheck installcheck-am installdirs \
- maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
- pdf pdf-am ps ps-am tags uninstall uninstall-am uninstall-hook \
- uninstall-libexecPROGRAMS uninstall-man uninstall-man5 \
- uninstall-man8
-
-
-install-suid-programs:
- @foo='$(bin_SUIDS)'; \
- for file in $$foo; do \
- x=$(DESTDIR)$(bindir)/$$file; \
- if chown 0:0 $$x && chmod u+s $$x; then :; else \
- echo "*"; \
- echo "* Failed to install $$x setuid root"; \
- echo "*"; \
- fi; done
-
-install-exec-hook: install-suid-programs
-
-install-build-headers:: $(include_HEADERS) $(dist_include_HEADERS) $(nodist_include_HEADERS) $(build_HEADERZ) $(nobase_include_HEADERS)
- @foo='$(include_HEADERS) $(dist_include_HEADERS) $(nodist_include_HEADERS) $(build_HEADERZ)'; \
- for f in $$foo; do \
- f=`basename $$f`; \
- if test -f "$(srcdir)/$$f"; then file="$(srcdir)/$$f"; \
- else file="$$f"; fi; \
- if cmp -s $$file $(buildinclude)/$$f 2> /dev/null ; then \
- : ; else \
- echo " $(CP) $$file $(buildinclude)/$$f"; \
- $(CP) $$file $(buildinclude)/$$f; \
- fi ; \
- done ; \
- foo='$(nobase_include_HEADERS)'; \
- for f in $$foo; do \
- if test -f "$(srcdir)/$$f"; then file="$(srcdir)/$$f"; \
- else file="$$f"; fi; \
- $(mkdir_p) $(buildinclude)/`dirname $$f` ; \
- if cmp -s $$file $(buildinclude)/$$f 2> /dev/null ; then \
- : ; else \
- echo " $(CP) $$file $(buildinclude)/$$f"; \
- $(CP) $$file $(buildinclude)/$$f; \
- fi ; \
- done
-
-all-local: install-build-headers
-
-check-local::
- @if test '$(CHECK_LOCAL)' = "no-check-local"; then \
- foo=''; elif test '$(CHECK_LOCAL)'; then \
- foo='$(CHECK_LOCAL)'; else \
- foo='$(PROGRAMS)'; fi; \
- if test "$$foo"; then \
- failed=0; all=0; \
- for i in $$foo; do \
- all=`expr $$all + 1`; \
- if (./$$i --version && ./$$i --help) > /dev/null 2>&1; then \
- echo "PASS: $$i"; \
- else \
- echo "FAIL: $$i"; \
- failed=`expr $$failed + 1`; \
- fi; \
- done; \
- if test "$$failed" -eq 0; then \
- banner="All $$all tests passed"; \
- else \
- banner="$$failed of $$all tests failed"; \
- fi; \
- dashes=`echo "$$banner" | sed s/./=/g`; \
- echo "$$dashes"; \
- echo "$$banner"; \
- echo "$$dashes"; \
- test "$$failed" -eq 0 || exit 1; \
- fi
-
-.x.c:
- @cmp -s $< $@ 2> /dev/null || cp $< $@
-
-.hx.h:
- @cmp -s $< $@ 2> /dev/null || cp $< $@
-#NROFF_MAN = nroff -man
-.1.cat1:
- $(NROFF_MAN) $< > $@
-.3.cat3:
- $(NROFF_MAN) $< > $@
-.5.cat5:
- $(NROFF_MAN) $< > $@
-.8.cat8:
- $(NROFF_MAN) $< > $@
-
-dist-cat1-mans:
- @foo='$(man1_MANS)'; \
- bar='$(man_MANS)'; \
- for i in $$bar; do \
- case $$i in \
- *.1) foo="$$foo $$i";; \
- esac; done ;\
- for i in $$foo; do \
- x=`echo $$i | sed 's/\.[^.]*$$/.cat1/'`; \
- echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \
- $(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \
- done
-
-dist-cat3-mans:
- @foo='$(man3_MANS)'; \
- bar='$(man_MANS)'; \
- for i in $$bar; do \
- case $$i in \
- *.3) foo="$$foo $$i";; \
- esac; done ;\
- for i in $$foo; do \
- x=`echo $$i | sed 's/\.[^.]*$$/.cat3/'`; \
- echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \
- $(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \
- done
-
-dist-cat5-mans:
- @foo='$(man5_MANS)'; \
- bar='$(man_MANS)'; \
- for i in $$bar; do \
- case $$i in \
- *.5) foo="$$foo $$i";; \
- esac; done ;\
- for i in $$foo; do \
- x=`echo $$i | sed 's/\.[^.]*$$/.cat5/'`; \
- echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \
- $(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \
- done
-
-dist-cat8-mans:
- @foo='$(man8_MANS)'; \
- bar='$(man_MANS)'; \
- for i in $$bar; do \
- case $$i in \
- *.8) foo="$$foo $$i";; \
- esac; done ;\
- for i in $$foo; do \
- x=`echo $$i | sed 's/\.[^.]*$$/.cat8/'`; \
- echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \
- $(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \
- done
-
-dist-hook: dist-cat1-mans dist-cat3-mans dist-cat5-mans dist-cat8-mans
-
-install-cat-mans:
- $(SHELL) $(top_srcdir)/cf/install-catman.sh install "$(INSTALL_DATA)" "$(mkinstalldirs)" "$(srcdir)" "$(DESTDIR)$(mandir)" '$(CATMANEXT)' $(man_MANS) $(man1_MANS) $(man3_MANS) $(man5_MANS) $(man8_MANS)
-
-uninstall-cat-mans:
- $(SHELL) $(top_srcdir)/cf/install-catman.sh uninstall "$(INSTALL_DATA)" "$(mkinstalldirs)" "$(srcdir)" "$(DESTDIR)$(mandir)" '$(CATMANEXT)' $(man_MANS) $(man1_MANS) $(man3_MANS) $(man5_MANS) $(man8_MANS)
-
-install-data-hook: install-cat-mans
-uninstall-hook: uninstall-cat-mans
-
-.et.h:
- $(COMPILE_ET) $<
-.et.c:
- $(COMPILE_ET) $<
-
-#
-# Useful target for debugging
-#
-
-check-valgrind:
- tobjdir=`cd $(top_builddir) && pwd` ; \
- tsrcdir=`cd $(top_srcdir) && pwd` ; \
- env TESTS_ENVIRONMENT="$${tsrcdir}/cf/maybe-valgrind.sh -s $${tsrcdir} -o $${tobjdir}" make check
-
-#
-# Target to please samba build farm, builds distfiles in-tree.
-# Will break when automake changes...
-#
-
-distdir-in-tree: $(DISTFILES) $(INFO_DEPS)
- list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
- if test "$$subdir" != .; then \
- (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) distdir-in-tree) ; \
- fi ; \
- done
-
-$(ftpd_OBJECTS): security.h
-
-security.c:
- @test -f security.c || $(LN_S) $(srcdir)/../ftp/security.c .
-security.h:
- @test -f security.h || $(LN_S) $(srcdir)/../ftp/security.h .
-gssapi.c:
- @test -f gssapi.c || $(LN_S) $(srcdir)/../ftp/gssapi.c .
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/appl/ftp/ftpd/NTMakefile b/appl/ftp/ftpd/NTMakefile
deleted file mode 100644
index 3b88d326f818..000000000000
--- a/appl/ftp/ftpd/NTMakefile
+++ /dev/null
@@ -1,35 +0,0 @@
-########################################################################
-#
-# Copyright (c) 2009, Secure Endpoints Inc.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# - Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-RELDIR=appl\ftp\ftpd
-
-!include ../../../windows/NTMakefile.w32
-
diff --git a/appl/ftp/ftpd/extern.h b/appl/ftp/ftpd/extern.h
deleted file mode 100644
index 3f48ec66eb5f..000000000000
--- a/appl/ftp/ftpd/extern.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)extern.h 8.2 (Berkeley) 4/4/94
- */
-
-#ifndef _EXTERN_H_
-#define _EXTERN_H_
-
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif
-
-#include <stdio.h>
-#include <stdarg.h>
-#ifdef HAVE_PWD_H
-#include <pwd.h>
-#endif
-
-#ifdef HAVE_LIMITS_H
-#include <limits.h>
-#endif
-
-#ifndef NBBY
-#define NBBY CHAR_BIT
-#endif
-
-void abor(void);
-void blkfree(char **);
-char **copyblk(char **);
-void cwd(const char *);
-void do_delete(char *);
-void dologout(int);
-void eprt(char *);
-void epsv(char *);
-void fatal(char *);
-int filename_check(char *);
-int ftpd_pclose(FILE *);
-FILE *ftpd_popen(char *, char *, int, int);
-char *ftpd_getline(char *, int);
-void ftpd_logwtmp(char *, char *, char *);
-void lreply(int, const char *, ...)
- __attribute__ ((format (printf, 2, 3)));
-void makedir(char *);
-void nack(char *);
-void nreply(const char *, ...)
- __attribute__ ((format (printf, 1, 2)));
-void pass(char *);
-void pasv(void);
-void perror_reply(int, const char *);
-void pwd(void);
-void removedir(char *);
-void renamecmd(char *, char *);
-char *renamefrom(char *);
-void reply(int, const char *, ...)
- __attribute__ ((format (printf, 2, 3)));
-void retrieve(const char *, char *);
-void send_file_list(char *);
-void setproctitle(const char *, ...)
- __attribute__ ((format (printf, 1, 2)));
-void statcmd(void);
-void statfilecmd(char *);
-void do_store(char *, char *, int);
-void upper(char *);
-void user(char *);
-void yyerror(char *);
-
-void list_file(char*);
-
-void kauth(char *, char*);
-void klist(void);
-void cond_kdestroy(void);
-void kdestroy(void);
-void krbtkfile(const char *tkfile);
-void afslog(const char *, int);
-void afsunlog(void);
-
-extern int do_destroy_tickets;
-extern char *k5ccname;
-
-int find(char *);
-
-int builtin_ls(FILE*, const char*);
-
-int do_login(int code, char *passwd);
-int klogin(char *name, char *password);
-
-const char *ftp_rooted(const char *path);
-
-extern struct sockaddr *ctrl_addr, *his_addr;
-extern char hostname[];
-
-extern struct sockaddr *data_dest;
-extern int logged_in;
-extern struct passwd *pw;
-extern int guest;
-extern int dochroot;
-extern int logging;
-extern int type;
-extern off_t file_size;
-extern off_t byte_count;
-extern int ccc_passed;
-
-extern int form;
-extern int debug;
-extern int ftpd_timeout;
-extern int maxtimeout;
-extern int pdata;
-extern char hostname[], remotehost[];
-extern char proctitle[];
-extern int usedefault;
-extern char tmpline[];
-extern int paranoid;
-
-#endif /* _EXTERN_H_ */
diff --git a/appl/ftp/ftpd/ftpcmd.c b/appl/ftp/ftpd/ftpcmd.c
deleted file mode 100644
index dab11bc952aa..000000000000
--- a/appl/ftp/ftpd/ftpcmd.c
+++ /dev/null
@@ -1,3532 +0,0 @@
-/* A Bison parser, made by GNU Bison 2.3. */
-
-/* Skeleton implementation for Bison's Yacc-like parsers in C
-
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
- Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA. */
-
-/* As a special exception, you may create a larger work that contains
- part or all of the Bison parser skeleton and distribute that work
- under terms of your choice, so long as that work isn't itself a
- parser generator using the skeleton or a modified version thereof
- as a parser skeleton. Alternatively, if you modify or redistribute
- the parser skeleton itself, you may (at your option) remove this
- special exception, which will cause the skeleton and the resulting
- Bison output files to be licensed under the GNU General Public
- License without this special exception.
-
- This special exception was added by the Free Software Foundation in
- version 2.2 of Bison. */
-
-/* C LALR(1) parser skeleton written by Richard Stallman, by
- simplifying the original so-called "semantic" parser. */
-
-/* All symbols defined below should begin with yy or YY, to avoid
- infringing on user name space. This should be done even for local
- variables, as they might otherwise be expanded by user macros.
- There are some unavoidable exceptions within include files to
- define necessary library symbols; they are noted "INFRINGES ON
- USER NAME SPACE" below. */
-
-/* Identify Bison output. */
-#define YYBISON 1
-
-/* Bison version. */
-#define YYBISON_VERSION "2.3"
-
-/* Skeleton name. */
-#define YYSKELETON_NAME "yacc.c"
-
-/* Pure parsers. */
-#define YYPURE 0
-
-/* Using locations. */
-#define YYLSP_NEEDED 0
-
-
-
-/* Tokens. */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum yytokentype {
- A = 258,
- B = 259,
- C = 260,
- E = 261,
- F = 262,
- I = 263,
- L = 264,
- N = 265,
- P = 266,
- R = 267,
- S = 268,
- T = 269,
- SP = 270,
- CRLF = 271,
- COMMA = 272,
- USER = 273,
- PASS = 274,
- ACCT = 275,
- REIN = 276,
- QUIT = 277,
- PORT = 278,
- PASV = 279,
- TYPE = 280,
- STRU = 281,
- MODE = 282,
- RETR = 283,
- STOR = 284,
- APPE = 285,
- MLFL = 286,
- MAIL = 287,
- MSND = 288,
- MSOM = 289,
- MSAM = 290,
- MRSQ = 291,
- MRCP = 292,
- ALLO = 293,
- REST = 294,
- RNFR = 295,
- RNTO = 296,
- ABOR = 297,
- DELE = 298,
- CWD = 299,
- LIST = 300,
- NLST = 301,
- SITE = 302,
- sTAT = 303,
- HELP = 304,
- NOOP = 305,
- MKD = 306,
- RMD = 307,
- PWD = 308,
- CDUP = 309,
- STOU = 310,
- SMNT = 311,
- SYST = 312,
- SIZE = 313,
- MDTM = 314,
- EPRT = 315,
- EPSV = 316,
- UMASK = 317,
- IDLE = 318,
- CHMOD = 319,
- AUTH = 320,
- ADAT = 321,
- PROT = 322,
- PBSZ = 323,
- CCC = 324,
- MIC = 325,
- CONF = 326,
- ENC = 327,
- KAUTH = 328,
- KLIST = 329,
- KDESTROY = 330,
- KRBTKFILE = 331,
- AFSLOG = 332,
- LOCATE = 333,
- URL = 334,
- FEAT = 335,
- OPTS = 336,
- LEXERR = 337,
- STRING = 338,
- NUMBER = 339
- };
-#endif
-/* Tokens. */
-#define A 258
-#define B 259
-#define C 260
-#define E 261
-#define F 262
-#define I 263
-#define L 264
-#define N 265
-#define P 266
-#define R 267
-#define S 268
-#define T 269
-#define SP 270
-#define CRLF 271
-#define COMMA 272
-#define USER 273
-#define PASS 274
-#define ACCT 275
-#define REIN 276
-#define QUIT 277
-#define PORT 278
-#define PASV 279
-#define TYPE 280
-#define STRU 281
-#define MODE 282
-#define RETR 283
-#define STOR 284
-#define APPE 285
-#define MLFL 286
-#define MAIL 287
-#define MSND 288
-#define MSOM 289
-#define MSAM 290
-#define MRSQ 291
-#define MRCP 292
-#define ALLO 293
-#define REST 294
-#define RNFR 295
-#define RNTO 296
-#define ABOR 297
-#define DELE 298
-#define CWD 299
-#define LIST 300
-#define NLST 301
-#define SITE 302
-#define sTAT 303
-#define HELP 304
-#define NOOP 305
-#define MKD 306
-#define RMD 307
-#define PWD 308
-#define CDUP 309
-#define STOU 310
-#define SMNT 311
-#define SYST 312
-#define SIZE 313
-#define MDTM 314
-#define EPRT 315
-#define EPSV 316
-#define UMASK 317
-#define IDLE 318
-#define CHMOD 319
-#define AUTH 320
-#define ADAT 321
-#define PROT 322
-#define PBSZ 323
-#define CCC 324
-#define MIC 325
-#define CONF 326
-#define ENC 327
-#define KAUTH 328
-#define KLIST 329
-#define KDESTROY 330
-#define KRBTKFILE 331
-#define AFSLOG 332
-#define LOCATE 333
-#define URL 334
-#define FEAT 335
-#define OPTS 336
-#define LEXERR 337
-#define STRING 338
-#define NUMBER 339
-
-
-
-
-/* Copy the first part of user declarations. */
-#line 43 "ftpcmd.y"
-
-
-#include "ftpd_locl.h"
-RCSID("$Id$");
-
-off_t restart_point;
-
-static int hasyyerrored;
-
-
-static int cmd_type;
-static int cmd_form;
-static int cmd_bytesz;
-char cbuf[64*1024];
-char *fromname;
-
-struct tab {
- char *name;
- short token;
- short state;
- short implemented; /* 1 if command is implemented */
- char *help;
-};
-
-extern struct tab cmdtab[];
-extern struct tab sitetab[];
-
-static char *copy (char *);
-static void help (struct tab *, char *);
-static struct tab *
- lookup (struct tab *, char *);
-static void sizecmd (char *);
-static RETSIGTYPE toolong (int);
-static int yylex (void);
-
-/* This is for bison */
-
-#if !defined(alloca) && !defined(HAVE_ALLOCA)
-#define alloca(x) malloc(x)
-#endif
-
-
-
-/* Enabling traces. */
-#ifndef YYDEBUG
-# define YYDEBUG 0
-#endif
-
-/* Enabling verbose error messages. */
-#ifdef YYERROR_VERBOSE
-# undef YYERROR_VERBOSE
-# define YYERROR_VERBOSE 1
-#else
-# define YYERROR_VERBOSE 0
-#endif
-
-/* Enabling the token table. */
-#ifndef YYTOKEN_TABLE
-# define YYTOKEN_TABLE 0
-#endif
-
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef union YYSTYPE
-#line 86 "ftpcmd.y"
-{
- int i;
- char *s;
-}
-/* Line 193 of yacc.c. */
-#line 312 "ftpcmd.c"
- YYSTYPE;
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
-# define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
-#endif
-
-
-
-/* Copy the second part of user declarations. */
-
-
-/* Line 216 of yacc.c. */
-#line 325 "ftpcmd.c"
-
-#ifdef short
-# undef short
-#endif
-
-#ifdef YYTYPE_UINT8
-typedef YYTYPE_UINT8 yytype_uint8;
-#else
-typedef unsigned char yytype_uint8;
-#endif
-
-#ifdef YYTYPE_INT8
-typedef YYTYPE_INT8 yytype_int8;
-#elif (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-typedef signed char yytype_int8;
-#else
-typedef short int yytype_int8;
-#endif
-
-#ifdef YYTYPE_UINT16
-typedef YYTYPE_UINT16 yytype_uint16;
-#else
-typedef unsigned short int yytype_uint16;
-#endif
-
-#ifdef YYTYPE_INT16
-typedef YYTYPE_INT16 yytype_int16;
-#else
-typedef short int yytype_int16;
-#endif
-
-#ifndef YYSIZE_T
-# ifdef __SIZE_TYPE__
-# define YYSIZE_T __SIZE_TYPE__
-# elif defined size_t
-# define YYSIZE_T size_t
-# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
-# define YYSIZE_T size_t
-# else
-# define YYSIZE_T unsigned int
-# endif
-#endif
-
-#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
-
-#ifndef YY_
-# if defined YYENABLE_NLS && YYENABLE_NLS
-# if ENABLE_NLS
-# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
-# define YY_(msgid) dgettext ("bison-runtime", msgid)
-# endif
-# endif
-# ifndef YY_
-# define YY_(msgid) msgid
-# endif
-#endif
-
-/* Suppress unused-variable warnings by "using" E. */
-#if ! defined lint || defined __GNUC__
-# define YYUSE(e) ((void) (e))
-#else
-# define YYUSE(e) /* empty */
-#endif
-
-/* Identity function, used to suppress warnings about constant conditions. */
-#ifndef lint
-# define YYID(n) (n)
-#else
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static int
-YYID (int i)
-#else
-static int
-YYID (i)
- int i;
-#endif
-{
- return i;
-}
-#endif
-
-#if ! defined yyoverflow || YYERROR_VERBOSE
-
-/* The parser invokes alloca or malloc; define the necessary symbols. */
-
-# ifdef YYSTACK_USE_ALLOCA
-# if YYSTACK_USE_ALLOCA
-# ifdef __GNUC__
-# define YYSTACK_ALLOC __builtin_alloca
-# elif defined __BUILTIN_VA_ARG_INCR
-# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
-# elif defined _AIX
-# define YYSTACK_ALLOC __alloca
-# elif defined _MSC_VER
-# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
-# define alloca _alloca
-# else
-# define YYSTACK_ALLOC alloca
-# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-# ifndef _STDLIB_H
-# define _STDLIB_H 1
-# endif
-# endif
-# endif
-# endif
-# endif
-
-# ifdef YYSTACK_ALLOC
- /* Pacify GCC's `empty if-body' warning. */
-# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
-# ifndef YYSTACK_ALLOC_MAXIMUM
- /* The OS might guarantee only one guard page at the bottom of the stack,
- and a page size can be as small as 4096 bytes. So we cannot safely
- invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
- to allow for a few compiler-allocated temporary stack slots. */
-# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
-# endif
-# else
-# define YYSTACK_ALLOC YYMALLOC
-# define YYSTACK_FREE YYFREE
-# ifndef YYSTACK_ALLOC_MAXIMUM
-# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
-# endif
-# if (defined __cplusplus && ! defined _STDLIB_H \
- && ! ((defined YYMALLOC || defined malloc) \
- && (defined YYFREE || defined free)))
-# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-# ifndef _STDLIB_H
-# define _STDLIB_H 1
-# endif
-# endif
-# ifndef YYMALLOC
-# define YYMALLOC malloc
-# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
-# endif
-# endif
-# ifndef YYFREE
-# define YYFREE free
-# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-void free (void *); /* INFRINGES ON USER NAME SPACE */
-# endif
-# endif
-# endif
-#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
-
-
-#if (! defined yyoverflow \
- && (! defined __cplusplus \
- || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
-
-/* A type that is properly aligned for any stack member. */
-union yyalloc
-{
- yytype_int16 yyss;
- YYSTYPE yyvs;
- };
-
-/* The size of the maximum gap between one aligned stack and the next. */
-# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
-
-/* The size of an array large to enough to hold all stacks, each with
- N elements. */
-# define YYSTACK_BYTES(N) \
- ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
- + YYSTACK_GAP_MAXIMUM)
-
-/* Copy COUNT objects from FROM to TO. The source and destination do
- not overlap. */
-# ifndef YYCOPY
-# if defined __GNUC__ && 1 < __GNUC__
-# define YYCOPY(To, From, Count) \
- __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
-# else
-# define YYCOPY(To, From, Count) \
- do \
- { \
- YYSIZE_T yyi; \
- for (yyi = 0; yyi < (Count); yyi++) \
- (To)[yyi] = (From)[yyi]; \
- } \
- while (YYID (0))
-# endif
-# endif
-
-/* Relocate STACK from its old location to the new one. The
- local variables YYSIZE and YYSTACKSIZE give the old and new number of
- elements in the stack, and YYPTR gives the new location of the
- stack. Advance YYPTR to a properly aligned location for the next
- stack. */
-# define YYSTACK_RELOCATE(Stack) \
- do \
- { \
- YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack, Stack, yysize); \
- Stack = &yyptr->Stack; \
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
- yyptr += yynewbytes / sizeof (*yyptr); \
- } \
- while (YYID (0))
-
-#endif
-
-/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 2
-/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 327
-
-/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 85
-/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 18
-/* YYNRULES -- Number of rules. */
-#define YYNRULES 98
-/* YYNRULES -- Number of states. */
-#define YYNSTATES 317
-
-/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
-#define YYUNDEFTOK 2
-#define YYMAXUTOK 339
-
-#define YYTRANSLATE(YYX) \
- ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
-
-/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
-static const yytype_uint8 yytranslate[] =
-{
- 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
- 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
- 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
- 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
- 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
- 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
- 75, 76, 77, 78, 79, 80, 81, 82, 83, 84
-};
-
-#if YYDEBUG
-/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
- YYRHS. */
-static const yytype_uint16 yyprhs[] =
-{
- 0, 0, 3, 4, 7, 10, 16, 22, 28, 34,
- 38, 42, 48, 54, 60, 66, 72, 82, 88, 94,
- 100, 104, 110, 114, 120, 126, 130, 136, 142, 146,
- 150, 156, 160, 166, 170, 176, 182, 186, 190, 194,
- 200, 206, 214, 220, 228, 238, 244, 252, 260, 266,
- 272, 280, 286, 294, 302, 308, 314, 318, 324, 330,
- 334, 337, 343, 349, 354, 359, 365, 371, 375, 380,
- 385, 390, 392, 393, 395, 397, 409, 411, 413, 415,
- 417, 421, 423, 427, 429, 431, 435, 438, 440, 442,
- 444, 446, 448, 450, 452, 454, 456, 458, 460
-};
-
-/* YYRHS -- A `-1'-separated list of the rules' RHS. */
-static const yytype_int8 yyrhs[] =
-{
- 86, 0, -1, -1, 86, 87, -1, 86, 88, -1,
- 18, 15, 89, 16, 102, -1, 19, 15, 90, 16,
- 102, -1, 23, 15, 92, 16, 102, -1, 60, 15,
- 83, 16, 102, -1, 24, 16, 101, -1, 61, 16,
- 101, -1, 61, 15, 83, 16, 101, -1, 25, 15,
- 94, 16, 102, -1, 26, 15, 95, 16, 102, -1,
- 27, 15, 96, 16, 102, -1, 38, 15, 84, 16,
- 102, -1, 38, 15, 84, 15, 12, 15, 84, 16,
- 102, -1, 28, 15, 97, 16, 101, -1, 29, 15,
- 97, 16, 101, -1, 30, 15, 97, 16, 101, -1,
- 46, 16, 101, -1, 46, 15, 83, 16, 101, -1,
- 45, 16, 101, -1, 45, 15, 97, 16, 101, -1,
- 48, 15, 97, 16, 101, -1, 48, 16, 102, -1,
- 43, 15, 97, 16, 100, -1, 41, 15, 97, 16,
- 100, -1, 42, 16, 102, -1, 44, 16, 101, -1,
- 44, 15, 97, 16, 101, -1, 49, 16, 102, -1,
- 49, 15, 83, 16, 102, -1, 50, 16, 102, -1,
- 51, 15, 97, 16, 101, -1, 52, 15, 97, 16,
- 100, -1, 53, 16, 101, -1, 54, 16, 101, -1,
- 80, 16, 102, -1, 81, 15, 83, 16, 102, -1,
- 47, 15, 49, 16, 102, -1, 47, 15, 49, 15,
- 83, 16, 102, -1, 47, 15, 62, 16, 101, -1,
- 47, 15, 62, 15, 99, 16, 100, -1, 47, 15,
- 64, 15, 99, 15, 97, 16, 100, -1, 47, 15,
- 63, 16, 102, -1, 47, 15, 63, 15, 84, 16,
- 102, -1, 47, 15, 73, 15, 83, 16, 101, -1,
- 47, 15, 74, 16, 101, -1, 47, 15, 75, 16,
- 101, -1, 47, 15, 76, 15, 83, 16, 101, -1,
- 47, 15, 77, 16, 101, -1, 47, 15, 77, 15,
- 83, 16, 101, -1, 47, 15, 78, 15, 83, 16,
- 101, -1, 47, 15, 79, 16, 102, -1, 55, 15,
- 97, 16, 101, -1, 57, 16, 102, -1, 58, 15,
- 97, 16, 101, -1, 59, 15, 97, 16, 101, -1,
- 22, 16, 102, -1, 1, 16, -1, 40, 15, 97,
- 16, 100, -1, 39, 15, 91, 16, 102, -1, 65,
- 15, 83, 16, -1, 66, 15, 83, 16, -1, 68,
- 15, 84, 16, 102, -1, 67, 15, 83, 16, 102,
- -1, 69, 16, 102, -1, 70, 15, 83, 16, -1,
- 71, 15, 83, 16, -1, 72, 15, 83, 16, -1,
- 83, -1, -1, 83, -1, 84, -1, 84, 17, 84,
- 17, 84, 17, 84, 17, 84, 17, 84, -1, 10,
- -1, 14, -1, 5, -1, 3, -1, 3, 15, 93,
- -1, 6, -1, 6, 15, 93, -1, 8, -1, 9,
- -1, 9, 15, 91, -1, 9, 91, -1, 7, -1,
- 12, -1, 11, -1, 13, -1, 4, -1, 5, -1,
- 98, -1, 83, -1, 84, -1, 101, -1, 102, -1,
- -1
-};
-
-/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
-static const yytype_uint16 yyrline[] =
-{
- 0, 129, 129, 131, 136, 140, 146, 154, 175, 181,
- 186, 191, 197, 234, 248, 262, 268, 274, 283, 292,
- 301, 306, 315, 320, 326, 333, 338, 345, 359, 364,
- 373, 380, 385, 402, 407, 414, 421, 426, 431, 441,
- 448, 453, 458, 466, 479, 493, 500, 517, 521, 526,
- 530, 534, 545, 558, 565, 570, 577, 595, 612, 640,
- 647, 653, 663, 673, 678, 683, 688, 693, 698, 703,
- 708, 716, 721, 724, 728, 732, 745, 749, 753, 760,
- 765, 770, 775, 780, 784, 789, 795, 803, 807, 811,
- 818, 822, 826, 833, 861, 865, 891, 899, 910
-};
-#endif
-
-#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
-/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
- First, the terminals, then, starting at YYNTOKENS, nonterminals. */
-static const char *const yytname[] =
-{
- "$end", "error", "$undefined", "A", "B", "C", "E", "F", "I", "L", "N",
- "P", "R", "S", "T", "SP", "CRLF", "COMMA", "USER", "PASS", "ACCT",
- "REIN", "QUIT", "PORT", "PASV", "TYPE", "STRU", "MODE", "RETR", "STOR",
- "APPE", "MLFL", "MAIL", "MSND", "MSOM", "MSAM", "MRSQ", "MRCP", "ALLO",
- "REST", "RNFR", "RNTO", "ABOR", "DELE", "CWD", "LIST", "NLST", "SITE",
- "sTAT", "HELP", "NOOP", "MKD", "RMD", "PWD", "CDUP", "STOU", "SMNT",
- "SYST", "SIZE", "MDTM", "EPRT", "EPSV", "UMASK", "IDLE", "CHMOD", "AUTH",
- "ADAT", "PROT", "PBSZ", "CCC", "MIC", "CONF", "ENC", "KAUTH", "KLIST",
- "KDESTROY", "KRBTKFILE", "AFSLOG", "LOCATE", "URL", "FEAT", "OPTS",
- "LEXERR", "STRING", "NUMBER", "$accept", "cmd_list", "cmd", "rcmd",
- "username", "password", "byte_size", "host_port", "form_code",
- "type_code", "struct_code", "mode_code", "pathname", "pathstring",
- "octal_number", "check_login_no_guest", "check_login", "check_secure", 0
-};
-#endif
-
-# ifdef YYPRINT
-/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
- token YYLEX-NUM. */
-static const yytype_uint16 yytoknum[] =
-{
- 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
- 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
- 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
- 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
- 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
- 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
- 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
- 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
- 335, 336, 337, 338, 339
-};
-# endif
-
-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
-static const yytype_uint8 yyr1[] =
-{
- 0, 85, 86, 86, 86, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 88, 88, 88, 88, 88, 88, 88, 88, 88,
- 88, 89, 90, 90, 91, 92, 93, 93, 93, 94,
- 94, 94, 94, 94, 94, 94, 94, 95, 95, 95,
- 96, 96, 96, 97, 98, 99, 100, 101, 102
-};
-
-/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
-static const yytype_uint8 yyr2[] =
-{
- 0, 2, 0, 2, 2, 5, 5, 5, 5, 3,
- 3, 5, 5, 5, 5, 5, 9, 5, 5, 5,
- 3, 5, 3, 5, 5, 3, 5, 5, 3, 3,
- 5, 3, 5, 3, 5, 5, 3, 3, 3, 5,
- 5, 7, 5, 7, 9, 5, 7, 7, 5, 5,
- 7, 5, 7, 7, 5, 5, 3, 5, 5, 3,
- 2, 5, 5, 4, 4, 5, 5, 3, 4, 4,
- 4, 1, 0, 1, 1, 11, 1, 1, 1, 1,
- 3, 1, 3, 1, 1, 3, 2, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 0
-};
-
-/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
- STATE-NUM when YYTABLE doesn't specify something else to do. Zero
- means the default is an error. */
-static const yytype_uint8 yydefact[] =
-{
- 2, 0, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 3, 4,
- 60, 0, 72, 98, 0, 98, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 98, 0, 0, 98,
- 0, 98, 0, 98, 0, 0, 98, 0, 98, 98,
- 0, 0, 98, 98, 0, 98, 0, 0, 0, 0,
- 98, 0, 0, 0, 0, 98, 0, 0, 0, 98,
- 0, 71, 0, 73, 0, 59, 0, 0, 9, 97,
- 79, 81, 83, 84, 0, 87, 89, 88, 0, 91,
- 92, 90, 0, 94, 0, 93, 0, 0, 0, 74,
- 0, 0, 0, 28, 0, 0, 29, 0, 22, 0,
- 20, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 25, 0, 31, 33, 0, 0, 36,
- 37, 0, 56, 0, 0, 0, 0, 10, 0, 0,
- 0, 0, 67, 0, 0, 0, 38, 0, 98, 98,
- 0, 98, 0, 0, 0, 86, 98, 98, 98, 98,
- 98, 98, 0, 98, 98, 98, 98, 98, 98, 98,
- 98, 0, 98, 0, 98, 0, 98, 0, 0, 98,
- 98, 0, 0, 98, 0, 98, 98, 98, 98, 98,
- 98, 98, 98, 98, 98, 63, 64, 98, 98, 68,
- 69, 70, 98, 5, 6, 0, 7, 78, 76, 77,
- 80, 82, 85, 12, 13, 14, 17, 18, 19, 0,
- 15, 62, 61, 96, 27, 26, 30, 23, 21, 0,
- 40, 95, 0, 42, 0, 45, 0, 0, 48, 49,
- 0, 0, 51, 0, 54, 24, 32, 34, 35, 55,
- 57, 58, 8, 11, 66, 65, 39, 0, 0, 98,
- 98, 98, 0, 98, 98, 98, 98, 0, 0, 41,
- 43, 46, 0, 47, 50, 52, 53, 0, 98, 98,
- 0, 16, 44, 0, 0, 0, 75
-};
-
-/* YYDEFGOTO[NTERM-NUM]. */
-static const yytype_int16 yydefgoto[] =
-{
- -1, 1, 48, 49, 102, 104, 130, 107, 240, 114,
- 118, 122, 124, 125, 262, 252, 253, 109
-};
-
-/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
- STATE-NUM. */
-#define YYPACT_NINF -196
-static const yytype_int16 yypact[] =
-{
- -196, 246, -196, 3, 13, 20, 11, 24, 21, 26,
- 30, 45, 66, 67, 68, 69, 70, 71, 72, 76,
- 73, -7, -5, 15, 78, 28, 32, 80, 79, 82,
- 83, 91, 93, 94, 96, 97, 98, 38, 100, 101,
- 102, 103, 104, 106, 107, 108, 111, 109, -196, -196,
- -196, -66, 36, -196, 14, -196, 12, 22, 1, 46,
- 46, 46, 25, 48, 46, 46, -196, 46, 46, -196,
- 46, -196, 53, -196, 27, 46, -196, 55, -196, -196,
- 46, 46, -196, -196, 46, -196, 46, 46, 56, 59,
- -196, 60, 61, 62, 63, -196, 65, 77, 85, -196,
- 86, -196, 114, -196, 115, -196, 120, 130, -196, -196,
- 135, 136, -196, -11, 138, -196, -196, -196, 139, -196,
- -196, -196, 143, -196, 145, -196, 147, 156, 47, -196,
- 157, 162, 165, -196, 166, 168, -196, 170, -196, 174,
- -196, 49, 52, 54, 137, 177, 178, 179, 181, 64,
- 182, 183, 184, -196, 185, -196, -196, 186, 187, -196,
- -196, 188, -196, 189, 190, 191, 192, -196, 193, 194,
- 195, 196, -196, 197, 198, 199, -196, 200, -196, -196,
- 133, -196, 2, 2, 48, -196, -196, -196, -196, -196,
- -196, -196, 206, -196, -196, -196, -196, -196, -196, -196,
- -196, 110, -196, 140, -196, 141, -196, 140, 144, -196,
- -196, 146, 148, -196, 149, -196, -196, -196, -196, -196,
- -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,
- -196, -196, -196, -196, -196, 202, -196, -196, -196, -196,
- -196, -196, -196, -196, -196, -196, -196, -196, -196, 205,
- -196, -196, -196, -196, -196, -196, -196, -196, -196, 207,
- -196, -196, 210, -196, 212, -196, 215, 217, -196, -196,
- 218, 219, -196, 221, -196, -196, -196, -196, -196, -196,
- -196, -196, -196, -196, -196, -196, -196, 155, 158, -196,
- -196, -196, 46, -196, -196, -196, -196, 204, 224, -196,
- -196, -196, 225, -196, -196, -196, -196, 159, -196, -196,
- 227, -196, -196, 161, 231, 167, -196
-};
-
-/* YYPGOTO[NTERM-NUM]. */
-static const yytype_int16 yypgoto[] =
-{
- -196, -196, -196, -196, -196, -196, -110, -196, 39, -196,
- -196, -196, -9, -196, 42, -195, -33, -53
-};
-
-/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
- positive, shift that token. If negative, reduce the rule which
- number is the opposite. If zero, do what YYDEFACT says.
- If YYTABLE_NINF, syntax error. */
-#define YYTABLE_NINF -1
-static const yytype_uint16 yytable[] =
-{
- 105, 254, 255, 185, 184, 119, 120, 237, 68, 69,
- 70, 71, 238, 133, 121, 110, 239, 101, 111, 50,
- 112, 113, 108, 153, 278, 155, 156, 53, 51, 115,
- 72, 73, 162, 116, 117, 52, 136, 55, 138, 54,
- 140, 56, 172, 75, 76, 57, 176, 77, 78, 159,
- 160, 126, 127, 89, 90, 131, 132, 167, 134, 135,
- 58, 137, 192, 193, 201, 202, 152, 203, 204, 205,
- 206, 157, 158, 129, 242, 161, 141, 163, 164, 212,
- 213, 59, 60, 61, 62, 63, 64, 65, 67, 142,
- 143, 144, 66, 74, 80, 300, 79, 81, 106, 82,
- 145, 146, 147, 148, 149, 150, 151, 83, 84, 128,
- 85, 86, 87, 88, 312, 91, 92, 93, 94, 103,
- 95, 96, 97, 98, 100, 233, 234, 99, 236, 123,
- 178, 179, 129, 243, 244, 245, 139, 180, 154, 165,
- 250, 251, 166, 168, 169, 170, 181, 171, 173, 260,
- 182, 183, 207, 265, 186, 187, 246, 247, 248, 188,
- 174, 189, 274, 190, 276, 256, 257, 258, 175, 177,
- 282, 263, 191, 194, 284, 285, 268, 269, 195, 286,
- 272, 196, 197, 275, 198, 277, 199, 279, 280, 281,
- 200, 283, 208, 259, 209, 210, 211, 214, 0, 215,
- 216, 217, 218, 219, 220, 221, 222, 223, 224, 225,
- 226, 227, 228, 229, 230, 231, 232, 235, 249, 287,
- 288, 307, 241, 289, 261, 264, 290, 267, 291, 270,
- 292, 271, 273, 293, 294, 295, 299, 296, 301, 297,
- 308, 309, 298, 310, 313, 314, 2, 3, 315, 266,
- 0, 316, 0, 0, 0, 311, 0, 0, 0, 0,
- 303, 304, 305, 306, 4, 5, 0, 0, 6, 7,
- 8, 9, 10, 11, 12, 13, 14, 0, 0, 0,
- 0, 0, 0, 302, 15, 16, 17, 18, 19, 20,
- 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
- 31, 32, 0, 33, 34, 35, 36, 37, 0, 0,
- 0, 38, 39, 40, 41, 42, 43, 44, 45, 0,
- 0, 0, 0, 0, 0, 0, 46, 47
-};
-
-static const yytype_int16 yycheck[] =
-{
- 53, 196, 197, 113, 15, 4, 5, 5, 15, 16,
- 15, 16, 10, 66, 13, 3, 14, 83, 6, 16,
- 8, 9, 55, 76, 219, 78, 79, 16, 15, 7,
- 15, 16, 85, 11, 12, 15, 69, 16, 71, 15,
- 73, 15, 95, 15, 16, 15, 99, 15, 16, 82,
- 83, 60, 61, 15, 16, 64, 65, 90, 67, 68,
- 15, 70, 15, 16, 15, 16, 75, 15, 16, 15,
- 16, 80, 81, 84, 184, 84, 49, 86, 87, 15,
- 16, 15, 15, 15, 15, 15, 15, 15, 15, 62,
- 63, 64, 16, 15, 15, 290, 16, 15, 84, 16,
- 73, 74, 75, 76, 77, 78, 79, 16, 15, 84,
- 16, 15, 15, 15, 309, 15, 15, 15, 15, 83,
- 16, 15, 15, 15, 15, 178, 179, 16, 181, 83,
- 16, 16, 84, 186, 187, 188, 83, 17, 83, 83,
- 193, 194, 83, 83, 83, 83, 16, 84, 83, 202,
- 15, 15, 15, 206, 16, 16, 189, 190, 191, 16,
- 83, 16, 215, 16, 217, 198, 199, 200, 83, 83,
- 223, 204, 16, 16, 227, 228, 209, 210, 16, 232,
- 213, 16, 16, 216, 16, 218, 16, 220, 221, 222,
- 16, 224, 15, 83, 16, 16, 15, 15, -1, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 84, 12, 17,
- 15, 17, 183, 16, 84, 84, 16, 83, 16, 83,
- 15, 83, 83, 16, 16, 16, 289, 16, 291, 84,
- 16, 16, 84, 84, 17, 84, 0, 1, 17, 207,
- -1, 84, -1, -1, -1, 308, -1, -1, -1, -1,
- 293, 294, 295, 296, 18, 19, -1, -1, 22, 23,
- 24, 25, 26, 27, 28, 29, 30, -1, -1, -1,
- -1, -1, -1, 292, 38, 39, 40, 41, 42, 43,
- 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
- 54, 55, -1, 57, 58, 59, 60, 61, -1, -1,
- -1, 65, 66, 67, 68, 69, 70, 71, 72, -1,
- -1, -1, -1, -1, -1, -1, 80, 81
-};
-
-/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
- symbol of state STATE-NUM. */
-static const yytype_uint8 yystos[] =
-{
- 0, 86, 0, 1, 18, 19, 22, 23, 24, 25,
- 26, 27, 28, 29, 30, 38, 39, 40, 41, 42,
- 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
- 53, 54, 55, 57, 58, 59, 60, 61, 65, 66,
- 67, 68, 69, 70, 71, 72, 80, 81, 87, 88,
- 16, 15, 15, 16, 15, 16, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 16, 15, 15, 16,
- 15, 16, 15, 16, 15, 15, 16, 15, 16, 16,
- 15, 15, 16, 16, 15, 16, 15, 15, 15, 15,
- 16, 15, 15, 15, 15, 16, 15, 15, 15, 16,
- 15, 83, 89, 83, 90, 102, 84, 92, 101, 102,
- 3, 6, 8, 9, 94, 7, 11, 12, 95, 4,
- 5, 13, 96, 83, 97, 98, 97, 97, 84, 84,
- 91, 97, 97, 102, 97, 97, 101, 97, 101, 83,
- 101, 49, 62, 63, 64, 73, 74, 75, 76, 77,
- 78, 79, 97, 102, 83, 102, 102, 97, 97, 101,
- 101, 97, 102, 97, 97, 83, 83, 101, 83, 83,
- 83, 84, 102, 83, 83, 83, 102, 83, 16, 16,
- 17, 16, 15, 15, 15, 91, 16, 16, 16, 16,
- 16, 16, 15, 16, 16, 16, 16, 16, 16, 16,
- 16, 15, 16, 15, 16, 15, 16, 15, 15, 16,
- 16, 15, 15, 16, 15, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 102, 102, 84, 102, 5, 10, 14,
- 93, 93, 91, 102, 102, 102, 101, 101, 101, 12,
- 102, 102, 100, 101, 100, 100, 101, 101, 101, 83,
- 102, 84, 99, 101, 84, 102, 99, 83, 101, 101,
- 83, 83, 101, 83, 102, 101, 102, 101, 100, 101,
- 101, 101, 102, 101, 102, 102, 102, 17, 15, 16,
- 16, 16, 15, 16, 16, 16, 16, 84, 84, 102,
- 100, 102, 97, 101, 101, 101, 101, 17, 16, 16,
- 84, 102, 100, 17, 84, 17, 84
-};
-
-#define yyerrok (yyerrstatus = 0)
-#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY (-2)
-#define YYEOF 0
-
-#define YYACCEPT goto yyacceptlab
-#define YYABORT goto yyabortlab
-#define YYERROR goto yyerrorlab
-
-
-/* Like YYERROR except do call yyerror. This remains here temporarily
- to ease the transition to the new meaning of YYERROR, for GCC.
- Once GCC version 2 has supplanted version 1, this can go. */
-
-#define YYFAIL goto yyerrlab
-
-#define YYRECOVERING() (!!yyerrstatus)
-
-#define YYBACKUP(Token, Value) \
-do \
- if (yychar == YYEMPTY && yylen == 1) \
- { \
- yychar = (Token); \
- yylval = (Value); \
- yytoken = YYTRANSLATE (yychar); \
- YYPOPSTACK (1); \
- goto yybackup; \
- } \
- else \
- { \
- yyerror (YY_("syntax error: cannot back up")); \
- YYERROR; \
- } \
-while (YYID (0))
-
-
-#define YYTERROR 1
-#define YYERRCODE 256
-
-
-/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
- If N is 0, then set CURRENT to the empty location which ends
- the previous symbol: RHS[0] (always defined). */
-
-#define YYRHSLOC(Rhs, K) ((Rhs)[K])
-#ifndef YYLLOC_DEFAULT
-# define YYLLOC_DEFAULT(Current, Rhs, N) \
- do \
- if (YYID (N)) \
- { \
- (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
- (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
- (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
- (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
- } \
- else \
- { \
- (Current).first_line = (Current).last_line = \
- YYRHSLOC (Rhs, 0).last_line; \
- (Current).first_column = (Current).last_column = \
- YYRHSLOC (Rhs, 0).last_column; \
- } \
- while (YYID (0))
-#endif
-
-
-/* YY_LOCATION_PRINT -- Print the location on the stream.
- This macro was not mandated originally: define only if we know
- we won't break user code: when these are the locations we know. */
-
-#ifndef YY_LOCATION_PRINT
-# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
-# define YY_LOCATION_PRINT(File, Loc) \
- fprintf (File, "%d.%d-%d.%d", \
- (Loc).first_line, (Loc).first_column, \
- (Loc).last_line, (Loc).last_column)
-# else
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-# endif
-#endif
-
-
-/* YYLEX -- calling `yylex' with the right arguments. */
-
-#ifdef YYLEX_PARAM
-# define YYLEX yylex (YYLEX_PARAM)
-#else
-# define YYLEX yylex ()
-#endif
-
-/* Enable debugging if requested. */
-#if YYDEBUG
-
-# ifndef YYFPRINTF
-# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
-# define YYFPRINTF fprintf
-# endif
-
-# define YYDPRINTF(Args) \
-do { \
- if (yydebug) \
- YYFPRINTF Args; \
-} while (YYID (0))
-
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
-do { \
- if (yydebug) \
- { \
- YYFPRINTF (stderr, "%s ", Title); \
- yy_symbol_print (stderr, \
- Type, Value); \
- YYFPRINTF (stderr, "\n"); \
- } \
-} while (YYID (0))
-
-
-/*--------------------------------.
-| Print this symbol on YYOUTPUT. |
-`--------------------------------*/
-
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static void
-yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
-#else
-static void
-yy_symbol_value_print (yyoutput, yytype, yyvaluep)
- FILE *yyoutput;
- int yytype;
- YYSTYPE const * const yyvaluep;
-#endif
-{
- if (!yyvaluep)
- return;
-# ifdef YYPRINT
- if (yytype < YYNTOKENS)
- YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
-# else
- YYUSE (yyoutput);
-# endif
- switch (yytype)
- {
- default:
- break;
- }
-}
-
-
-/*--------------------------------.
-| Print this symbol on YYOUTPUT. |
-`--------------------------------*/
-
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static void
-yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
-#else
-static void
-yy_symbol_print (yyoutput, yytype, yyvaluep)
- FILE *yyoutput;
- int yytype;
- YYSTYPE const * const yyvaluep;
-#endif
-{
- if (yytype < YYNTOKENS)
- YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
- else
- YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
-
- yy_symbol_value_print (yyoutput, yytype, yyvaluep);
- YYFPRINTF (yyoutput, ")");
-}
-
-/*------------------------------------------------------------------.
-| yy_stack_print -- Print the state stack from its BOTTOM up to its |
-| TOP (included). |
-`------------------------------------------------------------------*/
-
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static void
-yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
-#else
-static void
-yy_stack_print (bottom, top)
- yytype_int16 *bottom;
- yytype_int16 *top;
-#endif
-{
- YYFPRINTF (stderr, "Stack now");
- for (; bottom <= top; ++bottom)
- YYFPRINTF (stderr, " %d", *bottom);
- YYFPRINTF (stderr, "\n");
-}
-
-# define YY_STACK_PRINT(Bottom, Top) \
-do { \
- if (yydebug) \
- yy_stack_print ((Bottom), (Top)); \
-} while (YYID (0))
-
-
-/*------------------------------------------------.
-| Report that the YYRULE is going to be reduced. |
-`------------------------------------------------*/
-
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static void
-yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
-#else
-static void
-yy_reduce_print (yyvsp, yyrule)
- YYSTYPE *yyvsp;
- int yyrule;
-#endif
-{
- int yynrhs = yyr2[yyrule];
- int yyi;
- unsigned long int yylno = yyrline[yyrule];
- YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
- yyrule - 1, yylno);
- /* The symbols being reduced. */
- for (yyi = 0; yyi < yynrhs; yyi++)
- {
- fprintf (stderr, " $%d = ", yyi + 1);
- yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
- &(yyvsp[(yyi + 1) - (yynrhs)])
- );
- fprintf (stderr, "\n");
- }
-}
-
-# define YY_REDUCE_PRINT(Rule) \
-do { \
- if (yydebug) \
- yy_reduce_print (yyvsp, Rule); \
-} while (YYID (0))
-
-/* Nonzero means print parse trace. It is left uninitialized so that
- multiple parsers can coexist. */
-int yydebug;
-#else /* !YYDEBUG */
-# define YYDPRINTF(Args)
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
-# define YY_STACK_PRINT(Bottom, Top)
-# define YY_REDUCE_PRINT(Rule)
-#endif /* !YYDEBUG */
-
-
-/* YYINITDEPTH -- initial size of the parser's stacks. */
-#ifndef YYINITDEPTH
-# define YYINITDEPTH 200
-#endif
-
-/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
- if the built-in stack extension method is used).
-
- Do not make this value too large; the results are undefined if
- YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
- evaluated with infinite-precision integer arithmetic. */
-
-#ifndef YYMAXDEPTH
-# define YYMAXDEPTH 10000
-#endif
-
-
-
-#if YYERROR_VERBOSE
-
-# ifndef yystrlen
-# if defined __GLIBC__ && defined _STRING_H
-# define yystrlen strlen
-# else
-/* Return the length of YYSTR. */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static YYSIZE_T
-yystrlen (const char *yystr)
-#else
-static YYSIZE_T
-yystrlen (yystr)
- const char *yystr;
-#endif
-{
- YYSIZE_T yylen;
- for (yylen = 0; yystr[yylen]; yylen++)
- continue;
- return yylen;
-}
-# endif
-# endif
-
-# ifndef yystpcpy
-# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
-# define yystpcpy stpcpy
-# else
-/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
- YYDEST. */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static char *
-yystpcpy (char *yydest, const char *yysrc)
-#else
-static char *
-yystpcpy (yydest, yysrc)
- char *yydest;
- const char *yysrc;
-#endif
-{
- char *yyd = yydest;
- const char *yys = yysrc;
-
- while ((*yyd++ = *yys++) != '\0')
- continue;
-
- return yyd - 1;
-}
-# endif
-# endif
-
-# ifndef yytnamerr
-/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
- quotes and backslashes, so that it's suitable for yyerror. The
- heuristic is that double-quoting is unnecessary unless the string
- contains an apostrophe, a comma, or backslash (other than
- backslash-backslash). YYSTR is taken from yytname. If YYRES is
- null, do not copy; instead, return the length of what the result
- would have been. */
-static YYSIZE_T
-yytnamerr (char *yyres, const char *yystr)
-{
- if (*yystr == '"')
- {
- YYSIZE_T yyn = 0;
- char const *yyp = yystr;
-
- for (;;)
- switch (*++yyp)
- {
- case '\'':
- case ',':
- goto do_not_strip_quotes;
-
- case '\\':
- if (*++yyp != '\\')
- goto do_not_strip_quotes;
- /* Fall through. */
- default:
- if (yyres)
- yyres[yyn] = *yyp;
- yyn++;
- break;
-
- case '"':
- if (yyres)
- yyres[yyn] = '\0';
- return yyn;
- }
- do_not_strip_quotes: ;
- }
-
- if (! yyres)
- return yystrlen (yystr);
-
- return yystpcpy (yyres, yystr) - yyres;
-}
-# endif
-
-/* Copy into YYRESULT an error message about the unexpected token
- YYCHAR while in state YYSTATE. Return the number of bytes copied,
- including the terminating null byte. If YYRESULT is null, do not
- copy anything; just return the number of bytes that would be
- copied. As a special case, return 0 if an ordinary "syntax error"
- message will do. Return YYSIZE_MAXIMUM if overflow occurs during
- size calculation. */
-static YYSIZE_T
-yysyntax_error (char *yyresult, int yystate, int yychar)
-{
- int yyn = yypact[yystate];
-
- if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
- return 0;
- else
- {
- int yytype = YYTRANSLATE (yychar);
- YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
- YYSIZE_T yysize = yysize0;
- YYSIZE_T yysize1;
- int yysize_overflow = 0;
- enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
- char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
- int yyx;
-
-# if 0
- /* This is so xgettext sees the translatable formats that are
- constructed on the fly. */
- YY_("syntax error, unexpected %s");
- YY_("syntax error, unexpected %s, expecting %s");
- YY_("syntax error, unexpected %s, expecting %s or %s");
- YY_("syntax error, unexpected %s, expecting %s or %s or %s");
- YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
-# endif
- char *yyfmt;
- char const *yyf;
- static char const yyunexpected[] = "syntax error, unexpected %s";
- static char const yyexpecting[] = ", expecting %s";
- static char const yyor[] = " or %s";
- char yyformat[sizeof yyunexpected
- + sizeof yyexpecting - 1
- + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
- * (sizeof yyor - 1))];
- char const *yyprefix = yyexpecting;
-
- /* Start YYX at -YYN if negative to avoid negative indexes in
- YYCHECK. */
- int yyxbegin = yyn < 0 ? -yyn : 0;
-
- /* Stay within bounds of both yycheck and yytname. */
- int yychecklim = YYLAST - yyn + 1;
- int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
- int yycount = 1;
-
- yyarg[0] = yytname[yytype];
- yyfmt = yystpcpy (yyformat, yyunexpected);
-
- for (yyx = yyxbegin; yyx < yyxend; ++yyx)
- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
- {
- if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
- {
- yycount = 1;
- yysize = yysize0;
- yyformat[sizeof yyunexpected - 1] = '\0';
- break;
- }
- yyarg[yycount++] = yytname[yyx];
- yysize1 = yysize + yytnamerr (0, yytname[yyx]);
- yysize_overflow |= (yysize1 < yysize);
- yysize = yysize1;
- yyfmt = yystpcpy (yyfmt, yyprefix);
- yyprefix = yyor;
- }
-
- yyf = YY_(yyformat);
- yysize1 = yysize + yystrlen (yyf);
- yysize_overflow |= (yysize1 < yysize);
- yysize = yysize1;
-
- if (yysize_overflow)
- return YYSIZE_MAXIMUM;
-
- if (yyresult)
- {
- /* Avoid sprintf, as that infringes on the user's name space.
- Don't have undefined behavior even if the translation
- produced a string with the wrong number of "%s"s. */
- char *yyp = yyresult;
- int yyi = 0;
- while ((*yyp = *yyf) != '\0')
- {
- if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
- {
- yyp += yytnamerr (yyp, yyarg[yyi++]);
- yyf += 2;
- }
- else
- {
- yyp++;
- yyf++;
- }
- }
- }
- return yysize;
- }
-}
-#endif /* YYERROR_VERBOSE */
-
-
-/*-----------------------------------------------.
-| Release the memory associated to this symbol. |
-`-----------------------------------------------*/
-
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static void
-yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
-#else
-static void
-yydestruct (yymsg, yytype, yyvaluep)
- const char *yymsg;
- int yytype;
- YYSTYPE *yyvaluep;
-#endif
-{
- YYUSE (yyvaluep);
-
- if (!yymsg)
- yymsg = "Deleting";
- YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
-
- switch (yytype)
- {
-
- default:
- break;
- }
-}
-
-
-/* Prevent warnings from -Wmissing-prototypes. */
-
-#ifdef YYPARSE_PARAM
-#if defined __STDC__ || defined __cplusplus
-int yyparse (void *YYPARSE_PARAM);
-#else
-int yyparse ();
-#endif
-#else /* ! YYPARSE_PARAM */
-#if defined __STDC__ || defined __cplusplus
-int yyparse (void);
-#else
-int yyparse ();
-#endif
-#endif /* ! YYPARSE_PARAM */
-
-
-
-/* The look-ahead symbol. */
-int yychar;
-
-/* The semantic value of the look-ahead symbol. */
-YYSTYPE yylval;
-
-/* Number of syntax errors so far. */
-int yynerrs;
-
-
-
-/*----------.
-| yyparse. |
-`----------*/
-
-#ifdef YYPARSE_PARAM
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-int
-yyparse (void *YYPARSE_PARAM)
-#else
-int
-yyparse (YYPARSE_PARAM)
- void *YYPARSE_PARAM;
-#endif
-#else /* ! YYPARSE_PARAM */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-int
-yyparse (void)
-#else
-int
-yyparse ()
-
-#endif
-#endif
-{
-
- int yystate;
- int yyn;
- int yyresult;
- /* Number of tokens to shift before error messages enabled. */
- int yyerrstatus;
- /* Look-ahead token as an internal (translated) token number. */
- int yytoken = 0;
-#if YYERROR_VERBOSE
- /* Buffer for error messages, and its allocated size. */
- char yymsgbuf[128];
- char *yymsg = yymsgbuf;
- YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
-#endif
-
- /* Three stacks and their tools:
- `yyss': related to states,
- `yyvs': related to semantic values,
- `yyls': related to locations.
-
- Refer to the stacks thru separate pointers, to allow yyoverflow
- to reallocate them elsewhere. */
-
- /* The state stack. */
- yytype_int16 yyssa[YYINITDEPTH];
- yytype_int16 *yyss = yyssa;
- yytype_int16 *yyssp;
-
- /* The semantic value stack. */
- YYSTYPE yyvsa[YYINITDEPTH];
- YYSTYPE *yyvs = yyvsa;
- YYSTYPE *yyvsp;
-
-
-
-#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
-
- YYSIZE_T yystacksize = YYINITDEPTH;
-
- /* The variables used to return semantic value and location from the
- action routines. */
- YYSTYPE yyval;
-
-
- /* The number of symbols on the RHS of the reduced rule.
- Keep to zero when no symbol should be popped. */
- int yylen = 0;
-
- YYDPRINTF ((stderr, "Starting parse\n"));
-
- yystate = 0;
- yyerrstatus = 0;
- yynerrs = 0;
- yychar = YYEMPTY; /* Cause a token to be read. */
-
- /* Initialize stack pointers.
- Waste one element of value and location stack
- so that they stay on the same level as the state stack.
- The wasted elements are never initialized. */
-
- yyssp = yyss;
- yyvsp = yyvs;
-
- goto yysetstate;
-
-/*------------------------------------------------------------.
-| yynewstate -- Push a new state, which is found in yystate. |
-`------------------------------------------------------------*/
- yynewstate:
- /* In all cases, when you get here, the value and location stacks
- have just been pushed. So pushing a state here evens the stacks. */
- yyssp++;
-
- yysetstate:
- *yyssp = yystate;
-
- if (yyss + yystacksize - 1 <= yyssp)
- {
- /* Get the current used size of the three stacks, in elements. */
- YYSIZE_T yysize = yyssp - yyss + 1;
-
-#ifdef yyoverflow
- {
- /* Give user a chance to reallocate the stack. Use copies of
- these so that the &'s don't force the real ones into
- memory. */
- YYSTYPE *yyvs1 = yyvs;
- yytype_int16 *yyss1 = yyss;
-
-
- /* Each stack pointer address is followed by the size of the
- data in use in that stack, in bytes. This used to be a
- conditional around just the two extra args, but that might
- be undefined if yyoverflow is a macro. */
- yyoverflow (YY_("memory exhausted"),
- &yyss1, yysize * sizeof (*yyssp),
- &yyvs1, yysize * sizeof (*yyvsp),
-
- &yystacksize);
-
- yyss = yyss1;
- yyvs = yyvs1;
- }
-#else /* no yyoverflow */
-# ifndef YYSTACK_RELOCATE
- goto yyexhaustedlab;
-# else
- /* Extend the stack our own way. */
- if (YYMAXDEPTH <= yystacksize)
- goto yyexhaustedlab;
- yystacksize *= 2;
- if (YYMAXDEPTH < yystacksize)
- yystacksize = YYMAXDEPTH;
-
- {
- yytype_int16 *yyss1 = yyss;
- union yyalloc *yyptr =
- (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
- if (! yyptr)
- goto yyexhaustedlab;
- YYSTACK_RELOCATE (yyss);
- YYSTACK_RELOCATE (yyvs);
-
-# undef YYSTACK_RELOCATE
- if (yyss1 != yyssa)
- YYSTACK_FREE (yyss1);
- }
-# endif
-#endif /* no yyoverflow */
-
- yyssp = yyss + yysize - 1;
- yyvsp = yyvs + yysize - 1;
-
-
- YYDPRINTF ((stderr, "Stack size increased to %lu\n",
- (unsigned long int) yystacksize));
-
- if (yyss + yystacksize - 1 <= yyssp)
- YYABORT;
- }
-
- YYDPRINTF ((stderr, "Entering state %d\n", yystate));
-
- goto yybackup;
-
-/*-----------.
-| yybackup. |
-`-----------*/
-yybackup:
-
- /* Do appropriate processing given the current state. Read a
- look-ahead token if we need one and don't already have one. */
-
- /* First try to decide what to do without reference to look-ahead token. */
- yyn = yypact[yystate];
- if (yyn == YYPACT_NINF)
- goto yydefault;
-
- /* Not known => get a look-ahead token if don't already have one. */
-
- /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
- if (yychar == YYEMPTY)
- {
- YYDPRINTF ((stderr, "Reading a token: "));
- yychar = YYLEX;
- }
-
- if (yychar <= YYEOF)
- {
- yychar = yytoken = YYEOF;
- YYDPRINTF ((stderr, "Now at end of input.\n"));
- }
- else
- {
- yytoken = YYTRANSLATE (yychar);
- YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
- }
-
- /* If the proper action on seeing token YYTOKEN is to reduce or to
- detect an error, take that action. */
- yyn += yytoken;
- if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
- goto yydefault;
- yyn = yytable[yyn];
- if (yyn <= 0)
- {
- if (yyn == 0 || yyn == YYTABLE_NINF)
- goto yyerrlab;
- yyn = -yyn;
- goto yyreduce;
- }
-
- if (yyn == YYFINAL)
- YYACCEPT;
-
- /* Count tokens shifted since error; after three, turn off error
- status. */
- if (yyerrstatus)
- yyerrstatus--;
-
- /* Shift the look-ahead token. */
- YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
-
- /* Discard the shifted token unless it is eof. */
- if (yychar != YYEOF)
- yychar = YYEMPTY;
-
- yystate = yyn;
- *++yyvsp = yylval;
-
- goto yynewstate;
-
-
-/*-----------------------------------------------------------.
-| yydefault -- do the default action for the current state. |
-`-----------------------------------------------------------*/
-yydefault:
- yyn = yydefact[yystate];
- if (yyn == 0)
- goto yyerrlab;
- goto yyreduce;
-
-
-/*-----------------------------.
-| yyreduce -- Do a reduction. |
-`-----------------------------*/
-yyreduce:
- /* yyn is the number of a rule to reduce with. */
- yylen = yyr2[yyn];
-
- /* If YYLEN is nonzero, implement the default value of the action:
- `$$ = $1'.
-
- Otherwise, the following line sets YYVAL to garbage.
- This behavior is undocumented and Bison
- users should not rely upon it. Assigning to YYVAL
- unconditionally makes the parser a bit smaller, and it avoids a
- GCC warning that YYVAL may be used uninitialized. */
- yyval = yyvsp[1-yylen];
-
-
- YY_REDUCE_PRINT (yyn);
- switch (yyn)
- {
- case 3:
-#line 132 "ftpcmd.y"
- {
- fromname = (char *) 0;
- restart_point = (off_t) 0;
- }
- break;
-
- case 5:
-#line 141 "ftpcmd.y"
- {
- if ((yyvsp[(5) - (5)].i))
- user((yyvsp[(3) - (5)].s));
- free((yyvsp[(3) - (5)].s));
- }
- break;
-
- case 6:
-#line 147 "ftpcmd.y"
- {
- if ((yyvsp[(5) - (5)].i))
- pass((yyvsp[(3) - (5)].s));
- memset ((yyvsp[(3) - (5)].s), 0, strlen((yyvsp[(3) - (5)].s)));
- free((yyvsp[(3) - (5)].s));
- }
- break;
-
- case 7:
-#line 155 "ftpcmd.y"
- {
- if ((yyvsp[(5) - (5)].i)) {
- if (paranoid &&
- (data_dest->sa_family != his_addr->sa_family ||
- (socket_get_port(data_dest) < IPPORT_RESERVED) ||
- memcmp(socket_get_address(data_dest),
- socket_get_address(his_addr),
- socket_addr_size(his_addr)) != 0)) {
- usedefault = 1;
- reply(500, "Illegal PORT range rejected.");
- } else {
- usedefault = 0;
- if (pdata >= 0) {
- close(pdata);
- pdata = -1;
- }
- reply(200, "PORT command successful.");
- }
- }
- }
- break;
-
- case 8:
-#line 176 "ftpcmd.y"
- {
- if ((yyvsp[(5) - (5)].i))
- eprt ((yyvsp[(3) - (5)].s));
- free ((yyvsp[(3) - (5)].s));
- }
- break;
-
- case 9:
-#line 182 "ftpcmd.y"
- {
- if((yyvsp[(3) - (3)].i))
- pasv ();
- }
- break;
-
- case 10:
-#line 187 "ftpcmd.y"
- {
- if((yyvsp[(3) - (3)].i))
- epsv (NULL);
- }
- break;
-
- case 11:
-#line 192 "ftpcmd.y"
- {
- if((yyvsp[(5) - (5)].i))
- epsv ((yyvsp[(3) - (5)].s));
- free ((yyvsp[(3) - (5)].s));
- }
- break;
-
- case 12:
-#line 198 "ftpcmd.y"
- {
- if ((yyvsp[(5) - (5)].i)) {
- switch (cmd_type) {
-
- case TYPE_A:
- if (cmd_form == FORM_N) {
- reply(200, "Type set to A.");
- type = cmd_type;
- form = cmd_form;
- } else
- reply(504, "Form must be N.");
- break;
-
- case TYPE_E:
- reply(504, "Type E not implemented.");
- break;
-
- case TYPE_I:
- reply(200, "Type set to I.");
- type = cmd_type;
- break;
-
- case TYPE_L:
-#if NBBY == 8
- if (cmd_bytesz == 8) {
- reply(200,
- "Type set to L (byte size 8).");
- type = cmd_type;
- } else
- reply(504, "Byte size must be 8.");
-#else /* NBBY == 8 */
- UNIMPLEMENTED for NBBY != 8
-#endif /* NBBY == 8 */
- }
- }
- }
- break;
-
- case 13:
-#line 235 "ftpcmd.y"
- {
- if ((yyvsp[(5) - (5)].i)) {
- switch ((yyvsp[(3) - (5)].i)) {
-
- case STRU_F:
- reply(200, "STRU F ok.");
- break;
-
- default:
- reply(504, "Unimplemented STRU type.");
- }
- }
- }
- break;
-
- case 14:
-#line 249 "ftpcmd.y"
- {
- if ((yyvsp[(5) - (5)].i)) {
- switch ((yyvsp[(3) - (5)].i)) {
-
- case MODE_S:
- reply(200, "MODE S ok.");
- break;
-
- default:
- reply(502, "Unimplemented MODE type.");
- }
- }
- }
- break;
-
- case 15:
-#line 263 "ftpcmd.y"
- {
- if ((yyvsp[(5) - (5)].i)) {
- reply(202, "ALLO command ignored.");
- }
- }
- break;
-
- case 16:
-#line 269 "ftpcmd.y"
- {
- if ((yyvsp[(9) - (9)].i)) {
- reply(202, "ALLO command ignored.");
- }
- }
- break;
-
- case 17:
-#line 275 "ftpcmd.y"
- {
- char *name = (yyvsp[(3) - (5)].s);
-
- if ((yyvsp[(5) - (5)].i) && name != NULL)
- retrieve(0, name);
- if (name != NULL)
- free(name);
- }
- break;
-
- case 18:
-#line 284 "ftpcmd.y"
- {
- char *name = (yyvsp[(3) - (5)].s);
-
- if ((yyvsp[(5) - (5)].i) && name != NULL)
- do_store(name, "w", 0);
- if (name != NULL)
- free(name);
- }
- break;
-
- case 19:
-#line 293 "ftpcmd.y"
- {
- char *name = (yyvsp[(3) - (5)].s);
-
- if ((yyvsp[(5) - (5)].i) && name != NULL)
- do_store(name, "a", 0);
- if (name != NULL)
- free(name);
- }
- break;
-
- case 20:
-#line 302 "ftpcmd.y"
- {
- if ((yyvsp[(3) - (3)].i))
- send_file_list(".");
- }
- break;
-
- case 21:
-#line 307 "ftpcmd.y"
- {
- char *name = (yyvsp[(3) - (5)].s);
-
- if ((yyvsp[(5) - (5)].i) && name != NULL)
- send_file_list(name);
- if (name != NULL)
- free(name);
- }
- break;
-
- case 22:
-#line 316 "ftpcmd.y"
- {
- if((yyvsp[(3) - (3)].i))
- list_file(".");
- }
- break;
-
- case 23:
-#line 321 "ftpcmd.y"
- {
- if((yyvsp[(5) - (5)].i))
- list_file((yyvsp[(3) - (5)].s));
- free((yyvsp[(3) - (5)].s));
- }
- break;
-
- case 24:
-#line 327 "ftpcmd.y"
- {
- if ((yyvsp[(5) - (5)].i) && (yyvsp[(3) - (5)].s) != NULL)
- statfilecmd((yyvsp[(3) - (5)].s));
- if ((yyvsp[(3) - (5)].s) != NULL)
- free((yyvsp[(3) - (5)].s));
- }
- break;
-
- case 25:
-#line 334 "ftpcmd.y"
- {
- if ((yyvsp[(3) - (3)].i))
- statcmd();
- }
- break;
-
- case 26:
-#line 339 "ftpcmd.y"
- {
- if ((yyvsp[(5) - (5)].i) && (yyvsp[(3) - (5)].s) != NULL)
- do_delete((yyvsp[(3) - (5)].s));
- if ((yyvsp[(3) - (5)].s) != NULL)
- free((yyvsp[(3) - (5)].s));
- }
- break;
-
- case 27:
-#line 346 "ftpcmd.y"
- {
- if((yyvsp[(5) - (5)].i)){
- if (fromname) {
- renamecmd(fromname, (yyvsp[(3) - (5)].s));
- free(fromname);
- fromname = (char *) 0;
- } else {
- reply(503, "Bad sequence of commands.");
- }
- }
- if ((yyvsp[(3) - (5)].s) != NULL)
- free((yyvsp[(3) - (5)].s));
- }
- break;
-
- case 28:
-#line 360 "ftpcmd.y"
- {
- if ((yyvsp[(3) - (3)].i))
- reply(225, "ABOR command successful.");
- }
- break;
-
- case 29:
-#line 365 "ftpcmd.y"
- {
- if ((yyvsp[(3) - (3)].i)) {
- const char *path = pw->pw_dir;
- if (dochroot || guest)
- path = "/";
- cwd(path);
- }
- }
- break;
-
- case 30:
-#line 374 "ftpcmd.y"
- {
- if ((yyvsp[(5) - (5)].i) && (yyvsp[(3) - (5)].s) != NULL)
- cwd((yyvsp[(3) - (5)].s));
- if ((yyvsp[(3) - (5)].s) != NULL)
- free((yyvsp[(3) - (5)].s));
- }
- break;
-
- case 31:
-#line 381 "ftpcmd.y"
- {
- if ((yyvsp[(3) - (3)].i))
- help(cmdtab, (char *) 0);
- }
- break;
-
- case 32:
-#line 386 "ftpcmd.y"
- {
- if ((yyvsp[(5) - (5)].i)) {
- char *cp = (yyvsp[(3) - (5)].s);
-
- if (strncasecmp(cp, "SITE", 4) == 0) {
- cp = (yyvsp[(3) - (5)].s) + 4;
- if (*cp == ' ')
- cp++;
- if (*cp)
- help(sitetab, cp);
- else
- help(sitetab, (char *) 0);
- } else
- help(cmdtab, (yyvsp[(3) - (5)].s));
- }
- }
- break;
-
- case 33:
-#line 403 "ftpcmd.y"
- {
- if ((yyvsp[(3) - (3)].i))
- reply(200, "NOOP command successful.");
- }
- break;
-
- case 34:
-#line 408 "ftpcmd.y"
- {
- if ((yyvsp[(5) - (5)].i) && (yyvsp[(3) - (5)].s) != NULL)
- makedir((yyvsp[(3) - (5)].s));
- if ((yyvsp[(3) - (5)].s) != NULL)
- free((yyvsp[(3) - (5)].s));
- }
- break;
-
- case 35:
-#line 415 "ftpcmd.y"
- {
- if ((yyvsp[(5) - (5)].i) && (yyvsp[(3) - (5)].s) != NULL)
- removedir((yyvsp[(3) - (5)].s));
- if ((yyvsp[(3) - (5)].s) != NULL)
- free((yyvsp[(3) - (5)].s));
- }
- break;
-
- case 36:
-#line 422 "ftpcmd.y"
- {
- if ((yyvsp[(3) - (3)].i))
- pwd();
- }
- break;
-
- case 37:
-#line 427 "ftpcmd.y"
- {
- if ((yyvsp[(3) - (3)].i))
- cwd("..");
- }
- break;
-
- case 38:
-#line 432 "ftpcmd.y"
- {
- if ((yyvsp[(3) - (3)].i)) {
- lreply(211, "Supported features:");
- lreply(0, " MDTM");
- lreply(0, " REST STREAM");
- lreply(0, " SIZE");
- reply(211, "End");
- }
- }
- break;
-
- case 39:
-#line 442 "ftpcmd.y"
- {
- if ((yyvsp[(5) - (5)].i))
- reply(501, "Bad options");
- free ((yyvsp[(3) - (5)].s));
- }
- break;
-
- case 40:
-#line 449 "ftpcmd.y"
- {
- if ((yyvsp[(5) - (5)].i))
- help(sitetab, (char *) 0);
- }
- break;
-
- case 41:
-#line 454 "ftpcmd.y"
- {
- if ((yyvsp[(7) - (7)].i))
- help(sitetab, (yyvsp[(5) - (7)].s));
- }
- break;
-
- case 42:
-#line 459 "ftpcmd.y"
- {
- if ((yyvsp[(5) - (5)].i)) {
- int oldmask = umask(0);
- umask(oldmask);
- reply(200, "Current UMASK is %03o", oldmask);
- }
- }
- break;
-
- case 43:
-#line 467 "ftpcmd.y"
- {
- if ((yyvsp[(7) - (7)].i)) {
- if (((yyvsp[(5) - (7)].i) == -1) || ((yyvsp[(5) - (7)].i) > 0777)) {
- reply(501, "Bad UMASK value");
- } else {
- int oldmask = umask((yyvsp[(5) - (7)].i));
- reply(200,
- "UMASK set to %03o (was %03o)",
- (yyvsp[(5) - (7)].i), oldmask);
- }
- }
- }
- break;
-
- case 44:
-#line 480 "ftpcmd.y"
- {
- if ((yyvsp[(9) - (9)].i) && (yyvsp[(7) - (9)].s) != NULL) {
- if ((yyvsp[(5) - (9)].i) > 0777)
- reply(501,
- "CHMOD: Mode value must be between 0 and 0777");
- else if (chmod((yyvsp[(7) - (9)].s), (yyvsp[(5) - (9)].i)) < 0)
- perror_reply(550, (yyvsp[(7) - (9)].s));
- else
- reply(200, "CHMOD command successful.");
- }
- if ((yyvsp[(7) - (9)].s) != NULL)
- free((yyvsp[(7) - (9)].s));
- }
- break;
-
- case 45:
-#line 494 "ftpcmd.y"
- {
- if ((yyvsp[(5) - (5)].i))
- reply(200,
- "Current IDLE time limit is %d seconds; max %d",
- ftpd_timeout, maxtimeout);
- }
- break;
-
- case 46:
-#line 501 "ftpcmd.y"
- {
- if ((yyvsp[(7) - (7)].i)) {
- if ((yyvsp[(5) - (7)].i) < 30 || (yyvsp[(5) - (7)].i) > maxtimeout) {
- reply(501,
- "Maximum IDLE time must be between 30 and %d seconds",
- maxtimeout);
- } else {
- ftpd_timeout = (yyvsp[(5) - (7)].i);
- alarm((unsigned) ftpd_timeout);
- reply(200,
- "Maximum IDLE time set to %d seconds",
- ftpd_timeout);
- }
- }
- }
- break;
-
- case 47:
-#line 518 "ftpcmd.y"
- {
- reply(500, "Command not implemented.");
- }
- break;
-
- case 48:
-#line 522 "ftpcmd.y"
- {
- if((yyvsp[(5) - (5)].i))
- klist();
- }
- break;
-
- case 49:
-#line 527 "ftpcmd.y"
- {
- reply(500, "Command not implemented.");
- }
- break;
-
- case 50:
-#line 531 "ftpcmd.y"
- {
- reply(500, "Command not implemented.");
- }
- break;
-
- case 51:
-#line 535 "ftpcmd.y"
- {
-#if defined(KRB5)
- if(guest)
- reply(500, "Can't be done as guest.");
- else if((yyvsp[(5) - (5)].i))
- afslog(NULL, 0);
-#else
- reply(500, "Command not implemented.");
-#endif
- }
- break;
-
- case 52:
-#line 546 "ftpcmd.y"
- {
-#if defined(KRB5)
- if(guest)
- reply(500, "Can't be done as guest.");
- else if((yyvsp[(7) - (7)].i))
- afslog((yyvsp[(5) - (7)].s), 0);
- if((yyvsp[(5) - (7)].s))
- free((yyvsp[(5) - (7)].s));
-#else
- reply(500, "Command not implemented.");
-#endif
- }
- break;
-
- case 53:
-#line 559 "ftpcmd.y"
- {
- if((yyvsp[(7) - (7)].i) && (yyvsp[(5) - (7)].s) != NULL)
- find((yyvsp[(5) - (7)].s));
- if((yyvsp[(5) - (7)].s) != NULL)
- free((yyvsp[(5) - (7)].s));
- }
- break;
-
- case 54:
-#line 566 "ftpcmd.y"
- {
- if ((yyvsp[(5) - (5)].i))
- reply(200, "http://www.pdc.kth.se/heimdal/");
- }
- break;
-
- case 55:
-#line 571 "ftpcmd.y"
- {
- if ((yyvsp[(5) - (5)].i) && (yyvsp[(3) - (5)].s) != NULL)
- do_store((yyvsp[(3) - (5)].s), "w", 1);
- if ((yyvsp[(3) - (5)].s) != NULL)
- free((yyvsp[(3) - (5)].s));
- }
- break;
-
- case 56:
-#line 578 "ftpcmd.y"
- {
- if ((yyvsp[(3) - (3)].i)) {
-#if !defined(WIN32) && !defined(__EMX__) && !defined(__OS2__) && !defined(__CYGWIN32__)
- reply(215, "UNIX Type: L%d", NBBY);
-#else
- reply(215, "UNKNOWN Type: L%d", NBBY);
-#endif
- }
- }
- break;
-
- case 57:
-#line 596 "ftpcmd.y"
- {
- if ((yyvsp[(5) - (5)].i) && (yyvsp[(3) - (5)].s) != NULL)
- sizecmd((yyvsp[(3) - (5)].s));
- if ((yyvsp[(3) - (5)].s) != NULL)
- free((yyvsp[(3) - (5)].s));
- }
- break;
-
- case 58:
-#line 613 "ftpcmd.y"
- {
- if ((yyvsp[(5) - (5)].i) && (yyvsp[(3) - (5)].s) != NULL) {
- struct stat stbuf;
- if (stat((yyvsp[(3) - (5)].s), &stbuf) < 0)
- reply(550, "%s: %s",
- (yyvsp[(3) - (5)].s), strerror(errno));
- else if (!S_ISREG(stbuf.st_mode)) {
- reply(550,
- "%s: not a plain file.", (yyvsp[(3) - (5)].s));
- } else {
- struct tm *t;
- time_t mtime = stbuf.st_mtime;
-
- t = gmtime(&mtime);
- reply(213,
- "%04d%02d%02d%02d%02d%02d",
- t->tm_year + 1900,
- t->tm_mon + 1,
- t->tm_mday,
- t->tm_hour,
- t->tm_min,
- t->tm_sec);
- }
- }
- if ((yyvsp[(3) - (5)].s) != NULL)
- free((yyvsp[(3) - (5)].s));
- }
- break;
-
- case 59:
-#line 641 "ftpcmd.y"
- {
- if ((yyvsp[(3) - (3)].i)) {
- reply(221, "Goodbye.");
- dologout(0);
- }
- }
- break;
-
- case 60:
-#line 648 "ftpcmd.y"
- {
- yyerrok;
- }
- break;
-
- case 61:
-#line 654 "ftpcmd.y"
- {
- restart_point = (off_t) 0;
- if ((yyvsp[(5) - (5)].i) && (yyvsp[(3) - (5)].s)) {
- fromname = renamefrom((yyvsp[(3) - (5)].s));
- if (fromname == (char *) 0 && (yyvsp[(3) - (5)].s)) {
- free((yyvsp[(3) - (5)].s));
- }
- }
- }
- break;
-
- case 62:
-#line 664 "ftpcmd.y"
- {
- if ((yyvsp[(5) - (5)].i)) {
- fromname = (char *) 0;
- restart_point = (yyvsp[(3) - (5)].i); /* XXX $3 is only "int" */
- reply(350, "Restarting at %ld. %s",
- (long)restart_point,
- "Send STORE or RETRIEVE to initiate transfer.");
- }
- }
- break;
-
- case 63:
-#line 674 "ftpcmd.y"
- {
- auth((yyvsp[(3) - (4)].s));
- free((yyvsp[(3) - (4)].s));
- }
- break;
-
- case 64:
-#line 679 "ftpcmd.y"
- {
- adat((yyvsp[(3) - (4)].s));
- free((yyvsp[(3) - (4)].s));
- }
- break;
-
- case 65:
-#line 684 "ftpcmd.y"
- {
- if ((yyvsp[(5) - (5)].i))
- pbsz((yyvsp[(3) - (5)].i));
- }
- break;
-
- case 66:
-#line 689 "ftpcmd.y"
- {
- if ((yyvsp[(5) - (5)].i))
- prot((yyvsp[(3) - (5)].s));
- }
- break;
-
- case 67:
-#line 694 "ftpcmd.y"
- {
- if ((yyvsp[(3) - (3)].i))
- ccc();
- }
- break;
-
- case 68:
-#line 699 "ftpcmd.y"
- {
- mec((yyvsp[(3) - (4)].s), prot_safe);
- free((yyvsp[(3) - (4)].s));
- }
- break;
-
- case 69:
-#line 704 "ftpcmd.y"
- {
- mec((yyvsp[(3) - (4)].s), prot_confidential);
- free((yyvsp[(3) - (4)].s));
- }
- break;
-
- case 70:
-#line 709 "ftpcmd.y"
- {
- mec((yyvsp[(3) - (4)].s), prot_private);
- free((yyvsp[(3) - (4)].s));
- }
- break;
-
- case 72:
-#line 721 "ftpcmd.y"
- {
- (yyval.s) = (char *)calloc(1, sizeof(char));
- }
- break;
-
- case 75:
-#line 734 "ftpcmd.y"
- {
- struct sockaddr_in *sin4 = (struct sockaddr_in *)data_dest;
-
- sin4->sin_family = AF_INET;
- sin4->sin_port = htons((yyvsp[(9) - (11)].i) * 256 + (yyvsp[(11) - (11)].i));
- sin4->sin_addr.s_addr =
- htonl(((yyvsp[(1) - (11)].i) << 24) | ((yyvsp[(3) - (11)].i) << 16) | ((yyvsp[(5) - (11)].i) << 8) | (yyvsp[(7) - (11)].i));
- }
- break;
-
- case 76:
-#line 746 "ftpcmd.y"
- {
- (yyval.i) = FORM_N;
- }
- break;
-
- case 77:
-#line 750 "ftpcmd.y"
- {
- (yyval.i) = FORM_T;
- }
- break;
-
- case 78:
-#line 754 "ftpcmd.y"
- {
- (yyval.i) = FORM_C;
- }
- break;
-
- case 79:
-#line 761 "ftpcmd.y"
- {
- cmd_type = TYPE_A;
- cmd_form = FORM_N;
- }
- break;
-
- case 80:
-#line 766 "ftpcmd.y"
- {
- cmd_type = TYPE_A;
- cmd_form = (yyvsp[(3) - (3)].i);
- }
- break;
-
- case 81:
-#line 771 "ftpcmd.y"
- {
- cmd_type = TYPE_E;
- cmd_form = FORM_N;
- }
- break;
-
- case 82:
-#line 776 "ftpcmd.y"
- {
- cmd_type = TYPE_E;
- cmd_form = (yyvsp[(3) - (3)].i);
- }
- break;
-
- case 83:
-#line 781 "ftpcmd.y"
- {
- cmd_type = TYPE_I;
- }
- break;
-
- case 84:
-#line 785 "ftpcmd.y"
- {
- cmd_type = TYPE_L;
- cmd_bytesz = NBBY;
- }
- break;
-
- case 85:
-#line 790 "ftpcmd.y"
- {
- cmd_type = TYPE_L;
- cmd_bytesz = (yyvsp[(3) - (3)].i);
- }
- break;
-
- case 86:
-#line 796 "ftpcmd.y"
- {
- cmd_type = TYPE_L;
- cmd_bytesz = (yyvsp[(2) - (2)].i);
- }
- break;
-
- case 87:
-#line 804 "ftpcmd.y"
- {
- (yyval.i) = STRU_F;
- }
- break;
-
- case 88:
-#line 808 "ftpcmd.y"
- {
- (yyval.i) = STRU_R;
- }
- break;
-
- case 89:
-#line 812 "ftpcmd.y"
- {
- (yyval.i) = STRU_P;
- }
- break;
-
- case 90:
-#line 819 "ftpcmd.y"
- {
- (yyval.i) = MODE_S;
- }
- break;
-
- case 91:
-#line 823 "ftpcmd.y"
- {
- (yyval.i) = MODE_B;
- }
- break;
-
- case 92:
-#line 827 "ftpcmd.y"
- {
- (yyval.i) = MODE_C;
- }
- break;
-
- case 93:
-#line 834 "ftpcmd.y"
- {
- /*
- * Problem: this production is used for all pathname
- * processing, but only gives a 550 error reply.
- * This is a valid reply in some cases but not in others.
- */
- if (logged_in && (yyvsp[(1) - (1)].s) && *(yyvsp[(1) - (1)].s) == '~') {
- glob_t gl;
- int flags =
- GLOB_BRACE|GLOB_NOCHECK|GLOB_QUOTE|GLOB_TILDE;
-
- memset(&gl, 0, sizeof(gl));
- if (glob((yyvsp[(1) - (1)].s), flags, NULL, &gl) ||
- gl.gl_pathc == 0) {
- reply(550, "not found");
- (yyval.s) = NULL;
- } else {
- (yyval.s) = strdup(gl.gl_pathv[0]);
- }
- globfree(&gl);
- free((yyvsp[(1) - (1)].s));
- } else
- (yyval.s) = (yyvsp[(1) - (1)].s);
- }
- break;
-
- case 95:
-#line 866 "ftpcmd.y"
- {
- int ret, dec, multby, digit;
-
- /*
- * Convert a number that was read as decimal number
- * to what it would be if it had been read as octal.
- */
- dec = (yyvsp[(1) - (1)].i);
- multby = 1;
- ret = 0;
- while (dec) {
- digit = dec%10;
- if (digit > 7) {
- ret = -1;
- break;
- }
- ret += digit * multby;
- multby *= 8;
- dec /= 10;
- }
- (yyval.i) = ret;
- }
- break;
-
- case 96:
-#line 892 "ftpcmd.y"
- {
- (yyval.i) = (yyvsp[(1) - (1)].i) && !guest;
- if((yyvsp[(1) - (1)].i) && !(yyval.i))
- reply(550, "Permission denied");
- }
- break;
-
- case 97:
-#line 900 "ftpcmd.y"
- {
- if((yyvsp[(1) - (1)].i)) {
- if(((yyval.i) = logged_in) == 0)
- reply(530, "Please login with USER and PASS.");
- } else
- (yyval.i) = 0;
- }
- break;
-
- case 98:
-#line 910 "ftpcmd.y"
- {
- (yyval.i) = 1;
- if(sec_complete && !ccc_passed && !secure_command()) {
- (yyval.i) = 0;
- reply(533, "Command protection level denied "
- "for paranoid reasons.");
- }
- }
- break;
-
-
-/* Line 1267 of yacc.c. */
-#line 2759 "ftpcmd.c"
- default: break;
- }
- YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
-
- YYPOPSTACK (yylen);
- yylen = 0;
- YY_STACK_PRINT (yyss, yyssp);
-
- *++yyvsp = yyval;
-
-
- /* Now `shift' the result of the reduction. Determine what state
- that goes to, based on the state we popped back to and the rule
- number reduced by. */
-
- yyn = yyr1[yyn];
-
- yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
- if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
- yystate = yytable[yystate];
- else
- yystate = yydefgoto[yyn - YYNTOKENS];
-
- goto yynewstate;
-
-
-/*------------------------------------.
-| yyerrlab -- here on detecting error |
-`------------------------------------*/
-yyerrlab:
- /* If not already recovering from an error, report this error. */
- if (!yyerrstatus)
- {
- ++yynerrs;
-#if ! YYERROR_VERBOSE
- yyerror (YY_("syntax error"));
-#else
- {
- YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
- if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
- {
- YYSIZE_T yyalloc = 2 * yysize;
- if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
- yyalloc = YYSTACK_ALLOC_MAXIMUM;
- if (yymsg != yymsgbuf)
- YYSTACK_FREE (yymsg);
- yymsg = (char *) YYSTACK_ALLOC (yyalloc);
- if (yymsg)
- yymsg_alloc = yyalloc;
- else
- {
- yymsg = yymsgbuf;
- yymsg_alloc = sizeof yymsgbuf;
- }
- }
-
- if (0 < yysize && yysize <= yymsg_alloc)
- {
- (void) yysyntax_error (yymsg, yystate, yychar);
- yyerror (yymsg);
- }
- else
- {
- yyerror (YY_("syntax error"));
- if (yysize != 0)
- goto yyexhaustedlab;
- }
- }
-#endif
- }
-
-
-
- if (yyerrstatus == 3)
- {
- /* If just tried and failed to reuse look-ahead token after an
- error, discard it. */
-
- if (yychar <= YYEOF)
- {
- /* Return failure if at end of input. */
- if (yychar == YYEOF)
- YYABORT;
- }
- else
- {
- yydestruct ("Error: discarding",
- yytoken, &yylval);
- yychar = YYEMPTY;
- }
- }
-
- /* Else will try to reuse look-ahead token after shifting the error
- token. */
- goto yyerrlab1;
-
-
-/*---------------------------------------------------.
-| yyerrorlab -- error raised explicitly by YYERROR. |
-`---------------------------------------------------*/
-yyerrorlab:
-
- /* Pacify compilers like GCC when the user code never invokes
- YYERROR and the label yyerrorlab therefore never appears in user
- code. */
- if (/*CONSTCOND*/ 0)
- goto yyerrorlab;
-
- /* Do not reclaim the symbols of the rule which action triggered
- this YYERROR. */
- YYPOPSTACK (yylen);
- yylen = 0;
- YY_STACK_PRINT (yyss, yyssp);
- yystate = *yyssp;
- goto yyerrlab1;
-
-
-/*-------------------------------------------------------------.
-| yyerrlab1 -- common code for both syntax error and YYERROR. |
-`-------------------------------------------------------------*/
-yyerrlab1:
- yyerrstatus = 3; /* Each real token shifted decrements this. */
-
- for (;;)
- {
- yyn = yypact[yystate];
- if (yyn != YYPACT_NINF)
- {
- yyn += YYTERROR;
- if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
- {
- yyn = yytable[yyn];
- if (0 < yyn)
- break;
- }
- }
-
- /* Pop the current state because it cannot handle the error token. */
- if (yyssp == yyss)
- YYABORT;
-
-
- yydestruct ("Error: popping",
- yystos[yystate], yyvsp);
- YYPOPSTACK (1);
- yystate = *yyssp;
- YY_STACK_PRINT (yyss, yyssp);
- }
-
- if (yyn == YYFINAL)
- YYACCEPT;
-
- *++yyvsp = yylval;
-
-
- /* Shift the error token. */
- YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
-
- yystate = yyn;
- goto yynewstate;
-
-
-/*-------------------------------------.
-| yyacceptlab -- YYACCEPT comes here. |
-`-------------------------------------*/
-yyacceptlab:
- yyresult = 0;
- goto yyreturn;
-
-/*-----------------------------------.
-| yyabortlab -- YYABORT comes here. |
-`-----------------------------------*/
-yyabortlab:
- yyresult = 1;
- goto yyreturn;
-
-#ifndef yyoverflow
-/*-------------------------------------------------.
-| yyexhaustedlab -- memory exhaustion comes here. |
-`-------------------------------------------------*/
-yyexhaustedlab:
- yyerror (YY_("memory exhausted"));
- yyresult = 2;
- /* Fall through. */
-#endif
-
-yyreturn:
- if (yychar != YYEOF && yychar != YYEMPTY)
- yydestruct ("Cleanup: discarding lookahead",
- yytoken, &yylval);
- /* Do not reclaim the symbols of the rule which action triggered
- this YYABORT or YYACCEPT. */
- YYPOPSTACK (yylen);
- YY_STACK_PRINT (yyss, yyssp);
- while (yyssp != yyss)
- {
- yydestruct ("Cleanup: popping",
- yystos[*yyssp], yyvsp);
- YYPOPSTACK (1);
- }
-#ifndef yyoverflow
- if (yyss != yyssa)
- YYSTACK_FREE (yyss);
-#endif
-#if YYERROR_VERBOSE
- if (yymsg != yymsgbuf)
- YYSTACK_FREE (yymsg);
-#endif
- /* Make sure YYID is used. */
- return YYID (yyresult);
-}
-
-
-#line 920 "ftpcmd.y"
-
-
-#define CMD 0 /* beginning of command */
-#define ARGS 1 /* expect miscellaneous arguments */
-#define STR1 2 /* expect SP followed by STRING */
-#define STR2 3 /* expect STRING */
-#define OSTR 4 /* optional SP then STRING */
-#define ZSTR1 5 /* SP then optional STRING */
-#define ZSTR2 6 /* optional STRING after SP */
-#define SITECMD 7 /* SITE command */
-#define NSTR 8 /* Number followed by a string */
-
-struct tab cmdtab[] = { /* In order defined in RFC 765 */
- { "USER", USER, STR1, 1, "<sp> username" },
- { "PASS", PASS, ZSTR1, 1, "<sp> password" },
- { "ACCT", ACCT, STR1, 0, "(specify account)" },
- { "SMNT", SMNT, ARGS, 0, "(structure mount)" },
- { "REIN", REIN, ARGS, 0, "(reinitialize server state)" },
- { "QUIT", QUIT, ARGS, 1, "(terminate service)", },
- { "PORT", PORT, ARGS, 1, "<sp> b0, b1, b2, b3, b4" },
- { "EPRT", EPRT, STR1, 1, "<sp> string" },
- { "PASV", PASV, ARGS, 1, "(set server in passive mode)" },
- { "EPSV", EPSV, OSTR, 1, "[<sp> foo]" },
- { "TYPE", TYPE, ARGS, 1, "<sp> [ A | E | I | L ]" },
- { "STRU", STRU, ARGS, 1, "(specify file structure)" },
- { "MODE", MODE, ARGS, 1, "(specify transfer mode)" },
- { "RETR", RETR, STR1, 1, "<sp> file-name" },
- { "STOR", STOR, STR1, 1, "<sp> file-name" },
- { "APPE", APPE, STR1, 1, "<sp> file-name" },
- { "MLFL", MLFL, OSTR, 0, "(mail file)" },
- { "MAIL", MAIL, OSTR, 0, "(mail to user)" },
- { "MSND", MSND, OSTR, 0, "(mail send to terminal)" },
- { "MSOM", MSOM, OSTR, 0, "(mail send to terminal or mailbox)" },
- { "MSAM", MSAM, OSTR, 0, "(mail send to terminal and mailbox)" },
- { "MRSQ", MRSQ, OSTR, 0, "(mail recipient scheme question)" },
- { "MRCP", MRCP, STR1, 0, "(mail recipient)" },
- { "ALLO", ALLO, ARGS, 1, "allocate storage (vacuously)" },
- { "REST", REST, ARGS, 1, "<sp> offset (restart command)" },
- { "RNFR", RNFR, STR1, 1, "<sp> file-name" },
- { "RNTO", RNTO, STR1, 1, "<sp> file-name" },
- { "ABOR", ABOR, ARGS, 1, "(abort operation)" },
- { "DELE", DELE, STR1, 1, "<sp> file-name" },
- { "CWD", CWD, OSTR, 1, "[ <sp> directory-name ]" },
- { "XCWD", CWD, OSTR, 1, "[ <sp> directory-name ]" },
- { "LIST", LIST, OSTR, 1, "[ <sp> path-name ]" },
- { "NLST", NLST, OSTR, 1, "[ <sp> path-name ]" },
- { "SITE", SITE, SITECMD, 1, "site-cmd [ <sp> arguments ]" },
- { "SYST", SYST, ARGS, 1, "(get type of operating system)" },
- { "STAT", sTAT, OSTR, 1, "[ <sp> path-name ]" },
- { "HELP", HELP, OSTR, 1, "[ <sp> <string> ]" },
- { "NOOP", NOOP, ARGS, 1, "" },
- { "MKD", MKD, STR1, 1, "<sp> path-name" },
- { "XMKD", MKD, STR1, 1, "<sp> path-name" },
- { "RMD", RMD, STR1, 1, "<sp> path-name" },
- { "XRMD", RMD, STR1, 1, "<sp> path-name" },
- { "PWD", PWD, ARGS, 1, "(return current directory)" },
- { "XPWD", PWD, ARGS, 1, "(return current directory)" },
- { "CDUP", CDUP, ARGS, 1, "(change to parent directory)" },
- { "XCUP", CDUP, ARGS, 1, "(change to parent directory)" },
- { "STOU", STOU, STR1, 1, "<sp> file-name" },
- { "SIZE", SIZE, OSTR, 1, "<sp> path-name" },
- { "MDTM", MDTM, OSTR, 1, "<sp> path-name" },
-
- /* extensions from RFC2228 */
- { "AUTH", AUTH, STR1, 1, "<sp> auth-type" },
- { "ADAT", ADAT, STR1, 1, "<sp> auth-data" },
- { "PBSZ", PBSZ, ARGS, 1, "<sp> buffer-size" },
- { "PROT", PROT, STR1, 1, "<sp> prot-level" },
- { "CCC", CCC, ARGS, 1, "" },
- { "MIC", MIC, STR1, 1, "<sp> integrity command" },
- { "CONF", CONF, STR1, 1, "<sp> confidentiality command" },
- { "ENC", ENC, STR1, 1, "<sp> privacy command" },
-
- /* RFC2389 */
- { "FEAT", FEAT, ARGS, 1, "" },
- { "OPTS", OPTS, ARGS, 1, "<sp> command [<sp> options]" },
-
- { NULL, 0, 0, 0, 0 }
-};
-
-struct tab sitetab[] = {
- { "UMASK", UMASK, ARGS, 1, "[ <sp> umask ]" },
- { "IDLE", IDLE, ARGS, 1, "[ <sp> maximum-idle-time ]" },
- { "CHMOD", CHMOD, NSTR, 1, "<sp> mode <sp> file-name" },
- { "HELP", HELP, OSTR, 1, "[ <sp> <string> ]" },
-
- { "KAUTH", KAUTH, STR1, 1, "<sp> principal [ <sp> ticket ]" },
- { "KLIST", KLIST, ARGS, 1, "(show ticket file)" },
- { "KDESTROY", KDESTROY, ARGS, 1, "(destroy tickets)" },
- { "KRBTKFILE", KRBTKFILE, STR1, 1, "<sp> ticket-file" },
- { "AFSLOG", AFSLOG, OSTR, 1, "[<sp> cell]" },
-
- { "LOCATE", LOCATE, STR1, 1, "<sp> globexpr" },
- { "FIND", LOCATE, STR1, 1, "<sp> globexpr" },
-
- { "URL", URL, ARGS, 1, "?" },
-
- { NULL, 0, 0, 0, 0 }
-};
-
-static struct tab *
-lookup(struct tab *p, char *cmd)
-{
-
- for (; p->name != NULL; p++)
- if (strcmp(cmd, p->name) == 0)
- return (p);
- return (0);
-}
-
-/*
- * ftpd_getline - a hacked up version of fgets to ignore TELNET escape codes.
- */
-char *
-ftpd_getline(char *s, int n)
-{
- int c;
- char *cs;
-
- cs = s;
-
- /* might still be data within the security MIC/CONF/ENC */
- if(ftp_command){
- strlcpy(s, ftp_command, n);
- if (debug)
- syslog(LOG_DEBUG, "command: %s", s);
- return s;
- }
- while ((c = getc(stdin)) != EOF) {
- c &= 0377;
- if (c == IAC) {
- if ((c = getc(stdin)) != EOF) {
- c &= 0377;
- switch (c) {
- case WILL:
- case WONT:
- c = getc(stdin);
- printf("%c%c%c", IAC, DONT, 0377&c);
- fflush(stdout);
- continue;
- case DO:
- case DONT:
- c = getc(stdin);
- printf("%c%c%c", IAC, WONT, 0377&c);
- fflush(stdout);
- continue;
- case IAC:
- break;
- default:
- continue; /* ignore command */
- }
- }
- }
- *cs++ = c;
- if (--n <= 0 || c == '\n')
- break;
- }
- if (c == EOF && cs == s)
- return (NULL);
- *cs++ = '\0';
- if (debug) {
- if (!guest && strncasecmp("pass ", s, 5) == 0) {
- /* Don't syslog passwords */
- syslog(LOG_DEBUG, "command: %.5s ???", s);
- } else {
- char *cp;
- int len;
-
- /* Don't syslog trailing CR-LF */
- len = strlen(s);
- cp = s + len - 1;
- while (cp >= s && (*cp == '\n' || *cp == '\r')) {
- --cp;
- --len;
- }
- syslog(LOG_DEBUG, "command: %.*s", len, s);
- }
- }
-#ifdef XXX
- fprintf(stderr, "%s\n", s);
-#endif
- return (s);
-}
-
-static RETSIGTYPE
-toolong(int signo)
-{
-
- reply(421,
- "Timeout (%d seconds): closing control connection.",
- ftpd_timeout);
- if (logging)
- syslog(LOG_INFO, "User %s timed out after %d seconds",
- (pw ? pw -> pw_name : "unknown"), ftpd_timeout);
- dologout(1);
- SIGRETURN(0);
-}
-
-static int
-yylex(void)
-{
- static int cpos, state;
- char *cp, *cp2;
- struct tab *p;
- int n;
- char c;
-
- for (;;) {
- switch (state) {
-
- case CMD:
- hasyyerrored = 0;
-
- signal(SIGALRM, toolong);
- alarm((unsigned) ftpd_timeout);
- if (ftpd_getline(cbuf, sizeof(cbuf)-1) == NULL) {
- reply(221, "You could at least say goodbye.");
- dologout(0);
- }
- alarm(0);
-#ifdef HAVE_SETPROCTITLE
- if (strncasecmp(cbuf, "PASS", 4) != 0)
- setproctitle("%s: %s", proctitle, cbuf);
-#endif /* HAVE_SETPROCTITLE */
- if ((cp = strchr(cbuf, '\r'))) {
- *cp++ = '\n';
- *cp = '\0';
- }
- if ((cp = strpbrk(cbuf, " \n")))
- cpos = cp - cbuf;
- if (cpos == 0)
- cpos = 4;
- c = cbuf[cpos];
- cbuf[cpos] = '\0';
- strupr(cbuf);
- p = lookup(cmdtab, cbuf);
- cbuf[cpos] = c;
- if (p != 0) {
- if (p->implemented == 0) {
- nack(p->name);
- hasyyerrored = 1;
- break;
- }
- state = p->state;
- yylval.s = p->name;
- return (p->token);
- }
- break;
-
- case SITECMD:
- if (cbuf[cpos] == ' ') {
- cpos++;
- return (SP);
- }
- cp = &cbuf[cpos];
- if ((cp2 = strpbrk(cp, " \n")))
- cpos = cp2 - cbuf;
- c = cbuf[cpos];
- cbuf[cpos] = '\0';
- strupr(cp);
- p = lookup(sitetab, cp);
- cbuf[cpos] = c;
- if (p != 0) {
- if (p->implemented == 0) {
- state = CMD;
- nack(p->name);
- hasyyerrored = 1;
- break;
- }
- state = p->state;
- yylval.s = p->name;
- return (p->token);
- }
- state = CMD;
- break;
-
- case OSTR:
- if (cbuf[cpos] == '\n') {
- state = CMD;
- return (CRLF);
- }
- /* FALLTHROUGH */
-
- case STR1:
- case ZSTR1:
- dostr1:
- if (cbuf[cpos] == ' ') {
- cpos++;
- if(state == OSTR)
- state = STR2;
- else
- state++;
- return (SP);
- }
- break;
-
- case ZSTR2:
- if (cbuf[cpos] == '\n') {
- state = CMD;
- return (CRLF);
- }
- /* FALLTHROUGH */
-
- case STR2:
- cp = &cbuf[cpos];
- n = strlen(cp);
- cpos += n - 1;
- /*
- * Make sure the string is nonempty and \n terminated.
- */
- if (n > 1 && cbuf[cpos] == '\n') {
- cbuf[cpos] = '\0';
- yylval.s = copy(cp);
- cbuf[cpos] = '\n';
- state = ARGS;
- return (STRING);
- }
- break;
-
- case NSTR:
- if (cbuf[cpos] == ' ') {
- cpos++;
- return (SP);
- }
- if (isdigit((unsigned char)cbuf[cpos])) {
- cp = &cbuf[cpos];
- while (isdigit((unsigned char)cbuf[++cpos]))
- ;
- c = cbuf[cpos];
- cbuf[cpos] = '\0';
- yylval.i = atoi(cp);
- cbuf[cpos] = c;
- state = STR1;
- return (NUMBER);
- }
- state = STR1;
- goto dostr1;
-
- case ARGS:
- if (isdigit((unsigned char)cbuf[cpos])) {
- cp = &cbuf[cpos];
- while (isdigit((unsigned char)cbuf[++cpos]))
- ;
- c = cbuf[cpos];
- cbuf[cpos] = '\0';
- yylval.i = atoi(cp);
- cbuf[cpos] = c;
- return (NUMBER);
- }
- switch (cbuf[cpos++]) {
-
- case '\n':
- state = CMD;
- return (CRLF);
-
- case ' ':
- return (SP);
-
- case ',':
- return (COMMA);
-
- case 'A':
- case 'a':
- return (A);
-
- case 'B':
- case 'b':
- return (B);
-
- case 'C':
- case 'c':
- return (C);
-
- case 'E':
- case 'e':
- return (E);
-
- case 'F':
- case 'f':
- return (F);
-
- case 'I':
- case 'i':
- return (I);
-
- case 'L':
- case 'l':
- return (L);
-
- case 'N':
- case 'n':
- return (N);
-
- case 'P':
- case 'p':
- return (P);
-
- case 'R':
- case 'r':
- return (R);
-
- case 'S':
- case 's':
- return (S);
-
- case 'T':
- case 't':
- return (T);
-
- }
- break;
-
- default:
- fatal("Unknown state in scanner.");
- }
- yyerror(NULL);
- state = CMD;
- return (0);
- }
-}
-
-/* ARGSUSED */
-void
-yyerror(char *s)
-{
- char *cp;
-
- if (hasyyerrored)
- return;
-
- if ((cp = strchr(cbuf,'\n')))
- *cp = '\0';
- reply(500, "'%s': command not understood.", cbuf);
- hasyyerrored = 1;
-}
-
-static char *
-copy(char *s)
-{
- char *p;
-
- p = strdup(s);
- if (p == NULL)
- fatal("Ran out of memory.");
- return p;
-}
-
-static void
-help(struct tab *ctab, char *s)
-{
- struct tab *c;
- int width, NCMDS;
- char *t;
- char buf[1024];
-
- if (ctab == sitetab)
- t = "SITE ";
- else
- t = "";
- width = 0, NCMDS = 0;
- for (c = ctab; c->name != NULL; c++) {
- int len = strlen(c->name);
-
- if (len > width)
- width = len;
- NCMDS++;
- }
- width = (width + 8) &~ 7;
- if (s == 0) {
- int i, j, w;
- int columns, lines;
-
- lreply(214, "The following %scommands are recognized %s.",
- t, "(* =>'s unimplemented)");
- columns = 76 / width;
- if (columns == 0)
- columns = 1;
- lines = (NCMDS + columns - 1) / columns;
- for (i = 0; i < lines; i++) {
- strlcpy (buf, " ", sizeof(buf));
- for (j = 0; j < columns; j++) {
- c = ctab + j * lines + i;
- snprintf (buf + strlen(buf),
- sizeof(buf) - strlen(buf),
- "%s%c",
- c->name,
- c->implemented ? ' ' : '*');
- if (c + lines >= &ctab[NCMDS])
- break;
- w = strlen(c->name) + 1;
- while (w < width) {
- strlcat (buf,
- " ",
- sizeof(buf));
- w++;
- }
- }
- lreply(214, "%s", buf);
- }
- reply(214, "Direct comments to kth-krb-bugs@pdc.kth.se");
- return;
- }
- strupr(s);
- c = lookup(ctab, s);
- if (c == (struct tab *)0) {
- reply(502, "Unknown command %s.", s);
- return;
- }
- if (c->implemented)
- reply(214, "Syntax: %s%s %s", t, c->name, c->help);
- else
- reply(214, "%s%-*s\t%s; unimplemented.", t, width,
- c->name, c->help);
-}
-
-static void
-sizecmd(char *filename)
-{
- switch (type) {
- case TYPE_L:
- case TYPE_I: {
- struct stat stbuf;
- if (stat(filename, &stbuf) < 0 || !S_ISREG(stbuf.st_mode))
- reply(550, "%s: not a plain file.", filename);
- else
- reply(213, "%lu", (unsigned long)stbuf.st_size);
- break;
- }
- case TYPE_A: {
- FILE *fin;
- int c;
- size_t count;
- struct stat stbuf;
- fin = fopen(filename, "r");
- if (fin == NULL) {
- perror_reply(550, filename);
- return;
- }
- if (fstat(fileno(fin), &stbuf) < 0 || !S_ISREG(stbuf.st_mode)) {
- reply(550, "%s: not a plain file.", filename);
- fclose(fin);
- return;
- }
-
- count = 0;
- while((c=getc(fin)) != EOF) {
- if (c == '\n') /* will get expanded to \r\n */
- count++;
- count++;
- }
- fclose(fin);
-
- reply(213, "%lu", (unsigned long)count);
- break;
- }
- default:
- reply(504, "SIZE not implemented for Type %c.", "?AEIL"[type]);
- }
-}
-
diff --git a/appl/ftp/ftpd/ftpcmd.y b/appl/ftp/ftpd/ftpcmd.y
deleted file mode 100644
index 05ae7366bb46..000000000000
--- a/appl/ftp/ftpd/ftpcmd.y
+++ /dev/null
@@ -1,1478 +0,0 @@
-/* $NetBSD: ftpcmd.y,v 1.6 1995/06/03 22:46:45 mycroft Exp $ */
-
-/*
- * Copyright (c) 1985, 1988, 1993, 1994
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)ftpcmd.y 8.3 (Berkeley) 4/6/94
- */
-
-/*
- * Grammar for FTP commands.
- * See RFC 959.
- */
-
-%{
-
-#include "ftpd_locl.h"
-RCSID("$Id$");
-
-off_t restart_point;
-
-static int hasyyerrored;
-
-
-static int cmd_type;
-static int cmd_form;
-static int cmd_bytesz;
-char cbuf[64*1024];
-char *fromname;
-
-struct tab {
- char *name;
- short token;
- short state;
- short implemented; /* 1 if command is implemented */
- char *help;
-};
-
-extern struct tab cmdtab[];
-extern struct tab sitetab[];
-
-static char *copy (char *);
-static void help (struct tab *, char *);
-static struct tab *
- lookup (struct tab *, char *);
-static void sizecmd (char *);
-static RETSIGTYPE toolong (int);
-static int yylex (void);
-
-/* This is for bison */
-
-#if !defined(alloca) && !defined(HAVE_ALLOCA)
-#define alloca(x) malloc(x)
-#endif
-
-%}
-
-%union {
- int i;
- char *s;
-}
-
-%token
- A B C E F I
- L N P R S T
-
- SP CRLF COMMA
-
- USER PASS ACCT REIN QUIT PORT
- PASV TYPE STRU MODE RETR STOR
- APPE MLFL MAIL MSND MSOM MSAM
- MRSQ MRCP ALLO REST RNFR RNTO
- ABOR DELE CWD LIST NLST SITE
- sTAT HELP NOOP MKD RMD PWD
- CDUP STOU SMNT SYST SIZE MDTM
- EPRT EPSV
-
- UMASK IDLE CHMOD
-
- AUTH ADAT PROT PBSZ CCC MIC
- CONF ENC
-
- KAUTH KLIST KDESTROY KRBTKFILE AFSLOG
- LOCATE URL
-
- FEAT OPTS
-
- LEXERR
-
-%token <s> STRING
-%token <i> NUMBER
-
-%type <i> check_login check_login_no_guest check_secure octal_number byte_size
-%type <i> struct_code mode_code type_code form_code
-%type <s> pathstring pathname password username
-
-%start cmd_list
-
-%%
-
-cmd_list
- : /* empty */
- | cmd_list cmd
- {
- fromname = (char *) 0;
- restart_point = (off_t) 0;
- }
- | cmd_list rcmd
- ;
-
-cmd
- : USER SP username CRLF check_secure
- {
- if ($5)
- user($3);
- free($3);
- }
- | PASS SP password CRLF check_secure
- {
- if ($5)
- pass($3);
- memset ($3, 0, strlen($3));
- free($3);
- }
-
- | PORT SP host_port CRLF check_secure
- {
- if ($5) {
- if (paranoid &&
- (data_dest->sa_family != his_addr->sa_family ||
- (socket_get_port(data_dest) < IPPORT_RESERVED) ||
- memcmp(socket_get_address(data_dest),
- socket_get_address(his_addr),
- socket_addr_size(his_addr)) != 0)) {
- usedefault = 1;
- reply(500, "Illegal PORT range rejected.");
- } else {
- usedefault = 0;
- if (pdata >= 0) {
- close(pdata);
- pdata = -1;
- }
- reply(200, "PORT command successful.");
- }
- }
- }
- | EPRT SP STRING CRLF check_secure
- {
- if ($5)
- eprt ($3);
- free ($3);
- }
- | PASV CRLF check_login
- {
- if($3)
- pasv ();
- }
- | EPSV CRLF check_login
- {
- if($3)
- epsv (NULL);
- }
- | EPSV SP STRING CRLF check_login
- {
- if($5)
- epsv ($3);
- free ($3);
- }
- | TYPE SP type_code CRLF check_secure
- {
- if ($5) {
- switch (cmd_type) {
-
- case TYPE_A:
- if (cmd_form == FORM_N) {
- reply(200, "Type set to A.");
- type = cmd_type;
- form = cmd_form;
- } else
- reply(504, "Form must be N.");
- break;
-
- case TYPE_E:
- reply(504, "Type E not implemented.");
- break;
-
- case TYPE_I:
- reply(200, "Type set to I.");
- type = cmd_type;
- break;
-
- case TYPE_L:
-#if NBBY == 8
- if (cmd_bytesz == 8) {
- reply(200,
- "Type set to L (byte size 8).");
- type = cmd_type;
- } else
- reply(504, "Byte size must be 8.");
-#else /* NBBY == 8 */
- UNIMPLEMENTED for NBBY != 8
-#endif /* NBBY == 8 */
- }
- }
- }
- | STRU SP struct_code CRLF check_secure
- {
- if ($5) {
- switch ($3) {
-
- case STRU_F:
- reply(200, "STRU F ok.");
- break;
-
- default:
- reply(504, "Unimplemented STRU type.");
- }
- }
- }
- | MODE SP mode_code CRLF check_secure
- {
- if ($5) {
- switch ($3) {
-
- case MODE_S:
- reply(200, "MODE S ok.");
- break;
-
- default:
- reply(502, "Unimplemented MODE type.");
- }
- }
- }
- | ALLO SP NUMBER CRLF check_secure
- {
- if ($5) {
- reply(202, "ALLO command ignored.");
- }
- }
- | ALLO SP NUMBER SP R SP NUMBER CRLF check_secure
- {
- if ($9) {
- reply(202, "ALLO command ignored.");
- }
- }
- | RETR SP pathname CRLF check_login
- {
- char *name = $3;
-
- if ($5 && name != NULL)
- retrieve(0, name);
- if (name != NULL)
- free(name);
- }
- | STOR SP pathname CRLF check_login
- {
- char *name = $3;
-
- if ($5 && name != NULL)
- do_store(name, "w", 0);
- if (name != NULL)
- free(name);
- }
- | APPE SP pathname CRLF check_login
- {
- char *name = $3;
-
- if ($5 && name != NULL)
- do_store(name, "a", 0);
- if (name != NULL)
- free(name);
- }
- | NLST CRLF check_login
- {
- if ($3)
- send_file_list(".");
- }
- | NLST SP STRING CRLF check_login
- {
- char *name = $3;
-
- if ($5 && name != NULL)
- send_file_list(name);
- if (name != NULL)
- free(name);
- }
- | LIST CRLF check_login
- {
- if($3)
- list_file(".");
- }
- | LIST SP pathname CRLF check_login
- {
- if($5)
- list_file($3);
- free($3);
- }
- | sTAT SP pathname CRLF check_login
- {
- if ($5 && $3 != NULL)
- statfilecmd($3);
- if ($3 != NULL)
- free($3);
- }
- | sTAT CRLF check_secure
- {
- if ($3)
- statcmd();
- }
- | DELE SP pathname CRLF check_login_no_guest
- {
- if ($5 && $3 != NULL)
- do_delete($3);
- if ($3 != NULL)
- free($3);
- }
- | RNTO SP pathname CRLF check_login_no_guest
- {
- if($5){
- if (fromname) {
- renamecmd(fromname, $3);
- free(fromname);
- fromname = (char *) 0;
- } else {
- reply(503, "Bad sequence of commands.");
- }
- }
- if ($3 != NULL)
- free($3);
- }
- | ABOR CRLF check_secure
- {
- if ($3)
- reply(225, "ABOR command successful.");
- }
- | CWD CRLF check_login
- {
- if ($3) {
- const char *path = pw->pw_dir;
- if (dochroot || guest)
- path = "/";
- cwd(path);
- }
- }
- | CWD SP pathname CRLF check_login
- {
- if ($5 && $3 != NULL)
- cwd($3);
- if ($3 != NULL)
- free($3);
- }
- | HELP CRLF check_secure
- {
- if ($3)
- help(cmdtab, (char *) 0);
- }
- | HELP SP STRING CRLF check_secure
- {
- if ($5) {
- char *cp = $3;
-
- if (strncasecmp(cp, "SITE", 4) == 0) {
- cp = $3 + 4;
- if (*cp == ' ')
- cp++;
- if (*cp)
- help(sitetab, cp);
- else
- help(sitetab, (char *) 0);
- } else
- help(cmdtab, $3);
- }
- }
- | NOOP CRLF check_secure
- {
- if ($3)
- reply(200, "NOOP command successful.");
- }
- | MKD SP pathname CRLF check_login
- {
- if ($5 && $3 != NULL)
- makedir($3);
- if ($3 != NULL)
- free($3);
- }
- | RMD SP pathname CRLF check_login_no_guest
- {
- if ($5 && $3 != NULL)
- removedir($3);
- if ($3 != NULL)
- free($3);
- }
- | PWD CRLF check_login
- {
- if ($3)
- pwd();
- }
- | CDUP CRLF check_login
- {
- if ($3)
- cwd("..");
- }
- | FEAT CRLF check_secure
- {
- if ($3) {
- lreply(211, "Supported features:");
- lreply(0, " MDTM");
- lreply(0, " REST STREAM");
- lreply(0, " SIZE");
- reply(211, "End");
- }
- }
- | OPTS SP STRING CRLF check_secure
- {
- if ($5)
- reply(501, "Bad options");
- free ($3);
- }
-
- | SITE SP HELP CRLF check_secure
- {
- if ($5)
- help(sitetab, (char *) 0);
- }
- | SITE SP HELP SP STRING CRLF check_secure
- {
- if ($7)
- help(sitetab, $5);
- }
- | SITE SP UMASK CRLF check_login
- {
- if ($5) {
- int oldmask = umask(0);
- umask(oldmask);
- reply(200, "Current UMASK is %03o", oldmask);
- }
- }
- | SITE SP UMASK SP octal_number CRLF check_login_no_guest
- {
- if ($7) {
- if (($5 == -1) || ($5 > 0777)) {
- reply(501, "Bad UMASK value");
- } else {
- int oldmask = umask($5);
- reply(200,
- "UMASK set to %03o (was %03o)",
- $5, oldmask);
- }
- }
- }
- | SITE SP CHMOD SP octal_number SP pathname CRLF check_login_no_guest
- {
- if ($9 && $7 != NULL) {
- if ($5 > 0777)
- reply(501,
- "CHMOD: Mode value must be between 0 and 0777");
- else if (chmod($7, $5) < 0)
- perror_reply(550, $7);
- else
- reply(200, "CHMOD command successful.");
- }
- if ($7 != NULL)
- free($7);
- }
- | SITE SP IDLE CRLF check_secure
- {
- if ($5)
- reply(200,
- "Current IDLE time limit is %d seconds; max %d",
- ftpd_timeout, maxtimeout);
- }
- | SITE SP IDLE SP NUMBER CRLF check_secure
- {
- if ($7) {
- if ($5 < 30 || $5 > maxtimeout) {
- reply(501,
- "Maximum IDLE time must be between 30 and %d seconds",
- maxtimeout);
- } else {
- ftpd_timeout = $5;
- alarm((unsigned) ftpd_timeout);
- reply(200,
- "Maximum IDLE time set to %d seconds",
- ftpd_timeout);
- }
- }
- }
-
- | SITE SP KAUTH SP STRING CRLF check_login
- {
- reply(500, "Command not implemented.");
- }
- | SITE SP KLIST CRLF check_login
- {
- if($5)
- klist();
- }
- | SITE SP KDESTROY CRLF check_login
- {
- reply(500, "Command not implemented.");
- }
- | SITE SP KRBTKFILE SP STRING CRLF check_login
- {
- reply(500, "Command not implemented.");
- }
- | SITE SP AFSLOG CRLF check_login
- {
-#if defined(KRB5)
- if(guest)
- reply(500, "Can't be done as guest.");
- else if($5)
- afslog(NULL, 0);
-#else
- reply(500, "Command not implemented.");
-#endif
- }
- | SITE SP AFSLOG SP STRING CRLF check_login
- {
-#if defined(KRB5)
- if(guest)
- reply(500, "Can't be done as guest.");
- else if($7)
- afslog($5, 0);
- if($5)
- free($5);
-#else
- reply(500, "Command not implemented.");
-#endif
- }
- | SITE SP LOCATE SP STRING CRLF check_login
- {
- if($7 && $5 != NULL)
- find($5);
- if($5 != NULL)
- free($5);
- }
- | SITE SP URL CRLF check_secure
- {
- if ($5)
- reply(200, "http://www.pdc.kth.se/heimdal/");
- }
- | STOU SP pathname CRLF check_login
- {
- if ($5 && $3 != NULL)
- do_store($3, "w", 1);
- if ($3 != NULL)
- free($3);
- }
- | SYST CRLF check_secure
- {
- if ($3) {
-#if !defined(WIN32) && !defined(__EMX__) && !defined(__OS2__) && !defined(__CYGWIN32__)
- reply(215, "UNIX Type: L%d", NBBY);
-#else
- reply(215, "UNKNOWN Type: L%d", NBBY);
-#endif
- }
- }
-
- /*
- * SIZE is not in RFC959, but Postel has blessed it and
- * it will be in the updated RFC.
- *
- * Return size of file in a format suitable for
- * using with RESTART (we just count bytes).
- */
- | SIZE SP pathname CRLF check_login
- {
- if ($5 && $3 != NULL)
- sizecmd($3);
- if ($3 != NULL)
- free($3);
- }
-
- /*
- * MDTM is not in RFC959, but Postel has blessed it and
- * it will be in the updated RFC.
- *
- * Return modification time of file as an ISO 3307
- * style time. E.g. YYYYMMDDHHMMSS or YYYYMMDDHHMMSS.xxx
- * where xxx is the fractional second (of any precision,
- * not necessarily 3 digits)
- */
- | MDTM SP pathname CRLF check_login
- {
- if ($5 && $3 != NULL) {
- struct stat stbuf;
- if (stat($3, &stbuf) < 0)
- reply(550, "%s: %s",
- $3, strerror(errno));
- else if (!S_ISREG(stbuf.st_mode)) {
- reply(550,
- "%s: not a plain file.", $3);
- } else {
- struct tm *t;
- time_t mtime = stbuf.st_mtime;
-
- t = gmtime(&mtime);
- reply(213,
- "%04d%02d%02d%02d%02d%02d",
- t->tm_year + 1900,
- t->tm_mon + 1,
- t->tm_mday,
- t->tm_hour,
- t->tm_min,
- t->tm_sec);
- }
- }
- if ($3 != NULL)
- free($3);
- }
- | QUIT CRLF check_secure
- {
- if ($3) {
- reply(221, "Goodbye.");
- dologout(0);
- }
- }
- | error CRLF
- {
- yyerrok;
- }
- ;
-rcmd
- : RNFR SP pathname CRLF check_login_no_guest
- {
- restart_point = (off_t) 0;
- if ($5 && $3) {
- fromname = renamefrom($3);
- if (fromname == (char *) 0 && $3) {
- free($3);
- }
- }
- }
- | REST SP byte_size CRLF check_secure
- {
- if ($5) {
- fromname = (char *) 0;
- restart_point = $3; /* XXX $3 is only "int" */
- reply(350, "Restarting at %ld. %s",
- (long)restart_point,
- "Send STORE or RETRIEVE to initiate transfer.");
- }
- }
- | AUTH SP STRING CRLF
- {
- auth($3);
- free($3);
- }
- | ADAT SP STRING CRLF
- {
- adat($3);
- free($3);
- }
- | PBSZ SP NUMBER CRLF check_secure
- {
- if ($5)
- pbsz($3);
- }
- | PROT SP STRING CRLF check_secure
- {
- if ($5)
- prot($3);
- }
- | CCC CRLF check_secure
- {
- if ($3)
- ccc();
- }
- | MIC SP STRING CRLF
- {
- mec($3, prot_safe);
- free($3);
- }
- | CONF SP STRING CRLF
- {
- mec($3, prot_confidential);
- free($3);
- }
- | ENC SP STRING CRLF
- {
- mec($3, prot_private);
- free($3);
- }
- ;
-
-username
- : STRING
- ;
-
-password
- : /* empty */
- {
- $$ = (char *)calloc(1, sizeof(char));
- }
- | STRING
- ;
-
-byte_size
- : NUMBER
- ;
-
-host_port
- : NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER COMMA
- NUMBER COMMA NUMBER
- {
- struct sockaddr_in *sin4 = (struct sockaddr_in *)data_dest;
-
- sin4->sin_family = AF_INET;
- sin4->sin_port = htons($9 * 256 + $11);
- sin4->sin_addr.s_addr =
- htonl(($1 << 24) | ($3 << 16) | ($5 << 8) | $7);
- }
- ;
-
-form_code
- : N
- {
- $$ = FORM_N;
- }
- | T
- {
- $$ = FORM_T;
- }
- | C
- {
- $$ = FORM_C;
- }
- ;
-
-type_code
- : A
- {
- cmd_type = TYPE_A;
- cmd_form = FORM_N;
- }
- | A SP form_code
- {
- cmd_type = TYPE_A;
- cmd_form = $3;
- }
- | E
- {
- cmd_type = TYPE_E;
- cmd_form = FORM_N;
- }
- | E SP form_code
- {
- cmd_type = TYPE_E;
- cmd_form = $3;
- }
- | I
- {
- cmd_type = TYPE_I;
- }
- | L
- {
- cmd_type = TYPE_L;
- cmd_bytesz = NBBY;
- }
- | L SP byte_size
- {
- cmd_type = TYPE_L;
- cmd_bytesz = $3;
- }
- /* this is for a bug in the BBN ftp */
- | L byte_size
- {
- cmd_type = TYPE_L;
- cmd_bytesz = $2;
- }
- ;
-
-struct_code
- : F
- {
- $$ = STRU_F;
- }
- | R
- {
- $$ = STRU_R;
- }
- | P
- {
- $$ = STRU_P;
- }
- ;
-
-mode_code
- : S
- {
- $$ = MODE_S;
- }
- | B
- {
- $$ = MODE_B;
- }
- | C
- {
- $$ = MODE_C;
- }
- ;
-
-pathname
- : pathstring
- {
- /*
- * Problem: this production is used for all pathname
- * processing, but only gives a 550 error reply.
- * This is a valid reply in some cases but not in others.
- */
- if (logged_in && $1 && *$1 == '~') {
- glob_t gl;
- int flags =
- GLOB_BRACE|GLOB_NOCHECK|GLOB_QUOTE|GLOB_TILDE;
-
- memset(&gl, 0, sizeof(gl));
- if (glob($1, flags, NULL, &gl) ||
- gl.gl_pathc == 0) {
- reply(550, "not found");
- $$ = NULL;
- } else {
- $$ = strdup(gl.gl_pathv[0]);
- }
- globfree(&gl);
- free($1);
- } else
- $$ = $1;
- }
- ;
-
-pathstring
- : STRING
- ;
-
-octal_number
- : NUMBER
- {
- int ret, dec, multby, digit;
-
- /*
- * Convert a number that was read as decimal number
- * to what it would be if it had been read as octal.
- */
- dec = $1;
- multby = 1;
- ret = 0;
- while (dec) {
- digit = dec%10;
- if (digit > 7) {
- ret = -1;
- break;
- }
- ret += digit * multby;
- multby *= 8;
- dec /= 10;
- }
- $$ = ret;
- }
- ;
-
-
-check_login_no_guest : check_login
- {
- $$ = $1 && !guest;
- if($1 && !$$)
- reply(550, "Permission denied");
- }
- ;
-
-check_login : check_secure
- {
- if($1) {
- if(($$ = logged_in) == 0)
- reply(530, "Please login with USER and PASS.");
- } else
- $$ = 0;
- }
- ;
-
-check_secure : /* empty */
- {
- $$ = 1;
- if(sec_complete && !ccc_passed && !secure_command()) {
- $$ = 0;
- reply(533, "Command protection level denied "
- "for paranoid reasons.");
- }
- }
- ;
-
-%%
-
-#define CMD 0 /* beginning of command */
-#define ARGS 1 /* expect miscellaneous arguments */
-#define STR1 2 /* expect SP followed by STRING */
-#define STR2 3 /* expect STRING */
-#define OSTR 4 /* optional SP then STRING */
-#define ZSTR1 5 /* SP then optional STRING */
-#define ZSTR2 6 /* optional STRING after SP */
-#define SITECMD 7 /* SITE command */
-#define NSTR 8 /* Number followed by a string */
-
-struct tab cmdtab[] = { /* In order defined in RFC 765 */
- { "USER", USER, STR1, 1, "<sp> username" },
- { "PASS", PASS, ZSTR1, 1, "<sp> password" },
- { "ACCT", ACCT, STR1, 0, "(specify account)" },
- { "SMNT", SMNT, ARGS, 0, "(structure mount)" },
- { "REIN", REIN, ARGS, 0, "(reinitialize server state)" },
- { "QUIT", QUIT, ARGS, 1, "(terminate service)", },
- { "PORT", PORT, ARGS, 1, "<sp> b0, b1, b2, b3, b4" },
- { "EPRT", EPRT, STR1, 1, "<sp> string" },
- { "PASV", PASV, ARGS, 1, "(set server in passive mode)" },
- { "EPSV", EPSV, OSTR, 1, "[<sp> foo]" },
- { "TYPE", TYPE, ARGS, 1, "<sp> [ A | E | I | L ]" },
- { "STRU", STRU, ARGS, 1, "(specify file structure)" },
- { "MODE", MODE, ARGS, 1, "(specify transfer mode)" },
- { "RETR", RETR, STR1, 1, "<sp> file-name" },
- { "STOR", STOR, STR1, 1, "<sp> file-name" },
- { "APPE", APPE, STR1, 1, "<sp> file-name" },
- { "MLFL", MLFL, OSTR, 0, "(mail file)" },
- { "MAIL", MAIL, OSTR, 0, "(mail to user)" },
- { "MSND", MSND, OSTR, 0, "(mail send to terminal)" },
- { "MSOM", MSOM, OSTR, 0, "(mail send to terminal or mailbox)" },
- { "MSAM", MSAM, OSTR, 0, "(mail send to terminal and mailbox)" },
- { "MRSQ", MRSQ, OSTR, 0, "(mail recipient scheme question)" },
- { "MRCP", MRCP, STR1, 0, "(mail recipient)" },
- { "ALLO", ALLO, ARGS, 1, "allocate storage (vacuously)" },
- { "REST", REST, ARGS, 1, "<sp> offset (restart command)" },
- { "RNFR", RNFR, STR1, 1, "<sp> file-name" },
- { "RNTO", RNTO, STR1, 1, "<sp> file-name" },
- { "ABOR", ABOR, ARGS, 1, "(abort operation)" },
- { "DELE", DELE, STR1, 1, "<sp> file-name" },
- { "CWD", CWD, OSTR, 1, "[ <sp> directory-name ]" },
- { "XCWD", CWD, OSTR, 1, "[ <sp> directory-name ]" },
- { "LIST", LIST, OSTR, 1, "[ <sp> path-name ]" },
- { "NLST", NLST, OSTR, 1, "[ <sp> path-name ]" },
- { "SITE", SITE, SITECMD, 1, "site-cmd [ <sp> arguments ]" },
- { "SYST", SYST, ARGS, 1, "(get type of operating system)" },
- { "STAT", sTAT, OSTR, 1, "[ <sp> path-name ]" },
- { "HELP", HELP, OSTR, 1, "[ <sp> <string> ]" },
- { "NOOP", NOOP, ARGS, 1, "" },
- { "MKD", MKD, STR1, 1, "<sp> path-name" },
- { "XMKD", MKD, STR1, 1, "<sp> path-name" },
- { "RMD", RMD, STR1, 1, "<sp> path-name" },
- { "XRMD", RMD, STR1, 1, "<sp> path-name" },
- { "PWD", PWD, ARGS, 1, "(return current directory)" },
- { "XPWD", PWD, ARGS, 1, "(return current directory)" },
- { "CDUP", CDUP, ARGS, 1, "(change to parent directory)" },
- { "XCUP", CDUP, ARGS, 1, "(change to parent directory)" },
- { "STOU", STOU, STR1, 1, "<sp> file-name" },
- { "SIZE", SIZE, OSTR, 1, "<sp> path-name" },
- { "MDTM", MDTM, OSTR, 1, "<sp> path-name" },
-
- /* extensions from RFC2228 */
- { "AUTH", AUTH, STR1, 1, "<sp> auth-type" },
- { "ADAT", ADAT, STR1, 1, "<sp> auth-data" },
- { "PBSZ", PBSZ, ARGS, 1, "<sp> buffer-size" },
- { "PROT", PROT, STR1, 1, "<sp> prot-level" },
- { "CCC", CCC, ARGS, 1, "" },
- { "MIC", MIC, STR1, 1, "<sp> integrity command" },
- { "CONF", CONF, STR1, 1, "<sp> confidentiality command" },
- { "ENC", ENC, STR1, 1, "<sp> privacy command" },
-
- /* RFC2389 */
- { "FEAT", FEAT, ARGS, 1, "" },
- { "OPTS", OPTS, ARGS, 1, "<sp> command [<sp> options]" },
-
- { NULL, 0, 0, 0, 0 }
-};
-
-struct tab sitetab[] = {
- { "UMASK", UMASK, ARGS, 1, "[ <sp> umask ]" },
- { "IDLE", IDLE, ARGS, 1, "[ <sp> maximum-idle-time ]" },
- { "CHMOD", CHMOD, NSTR, 1, "<sp> mode <sp> file-name" },
- { "HELP", HELP, OSTR, 1, "[ <sp> <string> ]" },
-
- { "KAUTH", KAUTH, STR1, 1, "<sp> principal [ <sp> ticket ]" },
- { "KLIST", KLIST, ARGS, 1, "(show ticket file)" },
- { "KDESTROY", KDESTROY, ARGS, 1, "(destroy tickets)" },
- { "KRBTKFILE", KRBTKFILE, STR1, 1, "<sp> ticket-file" },
- { "AFSLOG", AFSLOG, OSTR, 1, "[<sp> cell]" },
-
- { "LOCATE", LOCATE, STR1, 1, "<sp> globexpr" },
- { "FIND", LOCATE, STR1, 1, "<sp> globexpr" },
-
- { "URL", URL, ARGS, 1, "?" },
-
- { NULL, 0, 0, 0, 0 }
-};
-
-static struct tab *
-lookup(struct tab *p, char *cmd)
-{
-
- for (; p->name != NULL; p++)
- if (strcmp(cmd, p->name) == 0)
- return (p);
- return (0);
-}
-
-/*
- * ftpd_getline - a hacked up version of fgets to ignore TELNET escape codes.
- */
-char *
-ftpd_getline(char *s, int n)
-{
- int c;
- char *cs;
-
- cs = s;
-
- /* might still be data within the security MIC/CONF/ENC */
- if(ftp_command){
- strlcpy(s, ftp_command, n);
- if (debug)
- syslog(LOG_DEBUG, "command: %s", s);
- return s;
- }
- while ((c = getc(stdin)) != EOF) {
- c &= 0377;
- if (c == IAC) {
- if ((c = getc(stdin)) != EOF) {
- c &= 0377;
- switch (c) {
- case WILL:
- case WONT:
- c = getc(stdin);
- printf("%c%c%c", IAC, DONT, 0377&c);
- fflush(stdout);
- continue;
- case DO:
- case DONT:
- c = getc(stdin);
- printf("%c%c%c", IAC, WONT, 0377&c);
- fflush(stdout);
- continue;
- case IAC:
- break;
- default:
- continue; /* ignore command */
- }
- }
- }
- *cs++ = c;
- if (--n <= 0 || c == '\n')
- break;
- }
- if (c == EOF && cs == s)
- return (NULL);
- *cs++ = '\0';
- if (debug) {
- if (!guest && strncasecmp("pass ", s, 5) == 0) {
- /* Don't syslog passwords */
- syslog(LOG_DEBUG, "command: %.5s ???", s);
- } else {
- char *cp;
- int len;
-
- /* Don't syslog trailing CR-LF */
- len = strlen(s);
- cp = s + len - 1;
- while (cp >= s && (*cp == '\n' || *cp == '\r')) {
- --cp;
- --len;
- }
- syslog(LOG_DEBUG, "command: %.*s", len, s);
- }
- }
-#ifdef XXX
- fprintf(stderr, "%s\n", s);
-#endif
- return (s);
-}
-
-static RETSIGTYPE
-toolong(int signo)
-{
-
- reply(421,
- "Timeout (%d seconds): closing control connection.",
- ftpd_timeout);
- if (logging)
- syslog(LOG_INFO, "User %s timed out after %d seconds",
- (pw ? pw -> pw_name : "unknown"), ftpd_timeout);
- dologout(1);
- SIGRETURN(0);
-}
-
-static int
-yylex(void)
-{
- static int cpos, state;
- char *cp, *cp2;
- struct tab *p;
- int n;
- char c;
-
- for (;;) {
- switch (state) {
-
- case CMD:
- hasyyerrored = 0;
-
- signal(SIGALRM, toolong);
- alarm((unsigned) ftpd_timeout);
- if (ftpd_getline(cbuf, sizeof(cbuf)-1) == NULL) {
- reply(221, "You could at least say goodbye.");
- dologout(0);
- }
- alarm(0);
-#ifdef HAVE_SETPROCTITLE
- if (strncasecmp(cbuf, "PASS", 4) != 0)
- setproctitle("%s: %s", proctitle, cbuf);
-#endif /* HAVE_SETPROCTITLE */
- if ((cp = strchr(cbuf, '\r'))) {
- *cp++ = '\n';
- *cp = '\0';
- }
- if ((cp = strpbrk(cbuf, " \n")))
- cpos = cp - cbuf;
- if (cpos == 0)
- cpos = 4;
- c = cbuf[cpos];
- cbuf[cpos] = '\0';
- strupr(cbuf);
- p = lookup(cmdtab, cbuf);
- cbuf[cpos] = c;
- if (p != 0) {
- if (p->implemented == 0) {
- nack(p->name);
- hasyyerrored = 1;
- break;
- }
- state = p->state;
- yylval.s = p->name;
- return (p->token);
- }
- break;
-
- case SITECMD:
- if (cbuf[cpos] == ' ') {
- cpos++;
- return (SP);
- }
- cp = &cbuf[cpos];
- if ((cp2 = strpbrk(cp, " \n")))
- cpos = cp2 - cbuf;
- c = cbuf[cpos];
- cbuf[cpos] = '\0';
- strupr(cp);
- p = lookup(sitetab, cp);
- cbuf[cpos] = c;
- if (p != 0) {
- if (p->implemented == 0) {
- state = CMD;
- nack(p->name);
- hasyyerrored = 1;
- break;
- }
- state = p->state;
- yylval.s = p->name;
- return (p->token);
- }
- state = CMD;
- break;
-
- case OSTR:
- if (cbuf[cpos] == '\n') {
- state = CMD;
- return (CRLF);
- }
- /* FALLTHROUGH */
-
- case STR1:
- case ZSTR1:
- dostr1:
- if (cbuf[cpos] == ' ') {
- cpos++;
- if(state == OSTR)
- state = STR2;
- else
- state++;
- return (SP);
- }
- break;
-
- case ZSTR2:
- if (cbuf[cpos] == '\n') {
- state = CMD;
- return (CRLF);
- }
- /* FALLTHROUGH */
-
- case STR2:
- cp = &cbuf[cpos];
- n = strlen(cp);
- cpos += n - 1;
- /*
- * Make sure the string is nonempty and \n terminated.
- */
- if (n > 1 && cbuf[cpos] == '\n') {
- cbuf[cpos] = '\0';
- yylval.s = copy(cp);
- cbuf[cpos] = '\n';
- state = ARGS;
- return (STRING);
- }
- break;
-
- case NSTR:
- if (cbuf[cpos] == ' ') {
- cpos++;
- return (SP);
- }
- if (isdigit((unsigned char)cbuf[cpos])) {
- cp = &cbuf[cpos];
- while (isdigit((unsigned char)cbuf[++cpos]))
- ;
- c = cbuf[cpos];
- cbuf[cpos] = '\0';
- yylval.i = atoi(cp);
- cbuf[cpos] = c;
- state = STR1;
- return (NUMBER);
- }
- state = STR1;
- goto dostr1;
-
- case ARGS:
- if (isdigit((unsigned char)cbuf[cpos])) {
- cp = &cbuf[cpos];
- while (isdigit((unsigned char)cbuf[++cpos]))
- ;
- c = cbuf[cpos];
- cbuf[cpos] = '\0';
- yylval.i = atoi(cp);
- cbuf[cpos] = c;
- return (NUMBER);
- }
- switch (cbuf[cpos++]) {
-
- case '\n':
- state = CMD;
- return (CRLF);
-
- case ' ':
- return (SP);
-
- case ',':
- return (COMMA);
-
- case 'A':
- case 'a':
- return (A);
-
- case 'B':
- case 'b':
- return (B);
-
- case 'C':
- case 'c':
- return (C);
-
- case 'E':
- case 'e':
- return (E);
-
- case 'F':
- case 'f':
- return (F);
-
- case 'I':
- case 'i':
- return (I);
-
- case 'L':
- case 'l':
- return (L);
-
- case 'N':
- case 'n':
- return (N);
-
- case 'P':
- case 'p':
- return (P);
-
- case 'R':
- case 'r':
- return (R);
-
- case 'S':
- case 's':
- return (S);
-
- case 'T':
- case 't':
- return (T);
-
- }
- break;
-
- default:
- fatal("Unknown state in scanner.");
- }
- yyerror(NULL);
- state = CMD;
- return (0);
- }
-}
-
-/* ARGSUSED */
-void
-yyerror(char *s)
-{
- char *cp;
-
- if (hasyyerrored)
- return;
-
- if ((cp = strchr(cbuf,'\n')))
- *cp = '\0';
- reply(500, "'%s': command not understood.", cbuf);
- hasyyerrored = 1;
-}
-
-static char *
-copy(char *s)
-{
- char *p;
-
- p = strdup(s);
- if (p == NULL)
- fatal("Ran out of memory.");
- return p;
-}
-
-static void
-help(struct tab *ctab, char *s)
-{
- struct tab *c;
- int width, NCMDS;
- char *t;
- char buf[1024];
-
- if (ctab == sitetab)
- t = "SITE ";
- else
- t = "";
- width = 0, NCMDS = 0;
- for (c = ctab; c->name != NULL; c++) {
- int len = strlen(c->name);
-
- if (len > width)
- width = len;
- NCMDS++;
- }
- width = (width + 8) &~ 7;
- if (s == 0) {
- int i, j, w;
- int columns, lines;
-
- lreply(214, "The following %scommands are recognized %s.",
- t, "(* =>'s unimplemented)");
- columns = 76 / width;
- if (columns == 0)
- columns = 1;
- lines = (NCMDS + columns - 1) / columns;
- for (i = 0; i < lines; i++) {
- strlcpy (buf, " ", sizeof(buf));
- for (j = 0; j < columns; j++) {
- c = ctab + j * lines + i;
- snprintf (buf + strlen(buf),
- sizeof(buf) - strlen(buf),
- "%s%c",
- c->name,
- c->implemented ? ' ' : '*');
- if (c + lines >= &ctab[NCMDS])
- break;
- w = strlen(c->name) + 1;
- while (w < width) {
- strlcat (buf,
- " ",
- sizeof(buf));
- w++;
- }
- }
- lreply(214, "%s", buf);
- }
- reply(214, "Direct comments to kth-krb-bugs@pdc.kth.se");
- return;
- }
- strupr(s);
- c = lookup(ctab, s);
- if (c == (struct tab *)0) {
- reply(502, "Unknown command %s.", s);
- return;
- }
- if (c->implemented)
- reply(214, "Syntax: %s%s %s", t, c->name, c->help);
- else
- reply(214, "%s%-*s\t%s; unimplemented.", t, width,
- c->name, c->help);
-}
-
-static void
-sizecmd(char *filename)
-{
- switch (type) {
- case TYPE_L:
- case TYPE_I: {
- struct stat stbuf;
- if (stat(filename, &stbuf) < 0 || !S_ISREG(stbuf.st_mode))
- reply(550, "%s: not a plain file.", filename);
- else
- reply(213, "%lu", (unsigned long)stbuf.st_size);
- break;
- }
- case TYPE_A: {
- FILE *fin;
- int c;
- size_t count;
- struct stat stbuf;
- fin = fopen(filename, "r");
- if (fin == NULL) {
- perror_reply(550, filename);
- return;
- }
- if (fstat(fileno(fin), &stbuf) < 0 || !S_ISREG(stbuf.st_mode)) {
- reply(550, "%s: not a plain file.", filename);
- fclose(fin);
- return;
- }
-
- count = 0;
- while((c=getc(fin)) != EOF) {
- if (c == '\n') /* will get expanded to \r\n */
- count++;
- count++;
- }
- fclose(fin);
-
- reply(213, "%lu", (unsigned long)count);
- break;
- }
- default:
- reply(504, "SIZE not implemented for Type %c.", "?AEIL"[type]);
- }
-}
diff --git a/appl/ftp/ftpd/ftpd.8 b/appl/ftp/ftpd/ftpd.8
deleted file mode 100644
index b025b1ecdaaa..000000000000
--- a/appl/ftp/ftpd/ftpd.8
+++ /dev/null
@@ -1,503 +0,0 @@
-.\" $NetBSD: ftpd.8,v 1.7 1995/04/11 02:44:53 cgd Exp $
-.\"
-.\" Copyright (c) 1985, 1988, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)ftpd.8 8.2 (Berkeley) 4/19/94
-.\"
-.Dd July 19, 2003
-.Dt FTPD 8
-.Os BSD 4.2
-.Sh NAME
-.Nm ftpd
-.Nd Internet File Transfer Protocol server
-.Sh SYNOPSIS
-.Nm
-.Op Fl a Ar authmode
-.Op Fl dilvU
-.Op Fl g Ar umask
-.Op Fl p Ar port
-.Op Fl T Ar maxtimeout
-.Op Fl t Ar timeout
-.Op Fl Fl gss-bindings
-.Op Fl I | Fl Fl no-insecure-oob
-.Op Fl u Ar default umask
-.Op Fl B | Fl Fl builtin-ls
-.Op Fl Fl good-chars= Ns Ar string
-.Sh DESCRIPTION
-.Nm Ftpd
-is the
-Internet File Transfer Protocol
-server process. The server uses the
-.Tn TCP
-protocol
-and listens at the port specified in the
-.Dq ftp
-service specification; see
-.Xr services 5 .
-.Pp
-Available options:
-.Bl -tag -width Ds
-.It Fl a
-Select the level of authentication required. Kerberised login can not
-be turned off. The default is to only allow kerberised login. Other
-possibilities can be turned on by giving a string of comma separated
-flags as argument to
-.Fl a .
-Recognised flags are:
-.Bl -tag -width plain
-.It Ar plain
-Allow logging in with plaintext password. The password can be a(n) OTP
-or an ordinary password.
-.It Ar otp
-Same as
-.Ar plain ,
-but only OTP is allowed.
-.It Ar ftp
-Allow anonymous login.
-.El
-.Pp
-The following combination modes exists for backwards compatibility:
-.Bl -tag -width plain
-.It Ar none
-Same as
-.Ar plain,ftp .
-.It Ar safe
-Same as
-.Ar ftp .
-.It Ar user
-Ignored.
-.El
-.It Fl d
-Debugging information is written to the syslog using LOG_FTP.
-.It Fl g
-Anonymous users will get a umask of
-.Ar umask .
-.It Fl Fl gss-bindings
-require the peer to use GSS-API bindings (ie make sure IP addresses match).
-.It Fl i
-Open a socket and wait for a connection. This is mainly used for
-debugging when ftpd isn't started by inetd.
-.It Fl l
-Each successful and failed
-.Xr ftp 1
-session is logged using syslog with a facility of LOG_FTP.
-If this option is specified twice, the retrieve (get), store (put), append,
-delete, make directory, remove directory and rename operations and
-their filename arguments are also logged.
-.It Fl p
-Use
-.Ar port
-(a service name or number) instead of the default
-.Ar ftp/tcp .
-.It Fl T
-A client may also request a different timeout period;
-the maximum period allowed may be set to
-.Ar timeout
-seconds with the
-.Fl T
-option.
-The default limit is 2 hours.
-.It Fl t
-The inactivity timeout period is set to
-.Ar timeout
-seconds (the default is 15 minutes).
-.It Fl u
-Set the initial umask to something else than the default 027.
-.It Fl U
-In previous versions of
-.Nm ftpd ,
-when a passive mode client requested a data connection to the server, the
-server would use data ports in the range 1024..4999. Now, by default,
-if the system supports the IP_PORTRANGE socket option, the server will
-use data ports in the range 49152..65535. Specifying this option will
-revert to the old behavior.
-.It Fl v
-Verbose mode.
-.It Xo
-.Fl B ,
-.Fl Fl builtin-ls
-.Xc
-use built-in ls to list files
-.It Xo
-.Fl Fl good-chars= Ns Ar string
-.Xc
-allowed anonymous upload filename chars
-.It Xo
-.Fl I
-.Fl Fl no-insecure-oob
-.Xc
-don't allow insecure out of band.
-Heimdal ftp clients before 0.6.3 doesn't support secure oob, so turning
-on this option makes them no longer work.
-.El
-.Pp
-The file
-.Pa /etc/nologin
-can be used to disable ftp access.
-If the file exists,
-.Nm
-displays it and exits.
-If the file
-.Pa /etc/ftpwelcome
-exists,
-.Nm
-prints it before issuing the
-.Dq ready
-message.
-If the file
-.Pa /etc/motd
-exists,
-.Nm
-prints it after a successful login.
-.Pp
-The ftp server currently supports the following ftp requests.
-The case of the requests is ignored.
-.Bl -column "Request" -offset indent
-.It Request Ta "Description"
-.It ABOR Ta "abort previous command"
-.It ACCT Ta "specify account (ignored)"
-.It ALLO Ta "allocate storage (vacuously)"
-.It APPE Ta "append to a file"
-.It CDUP Ta "change to parent of current working directory"
-.It CWD Ta "change working directory"
-.It DELE Ta "delete a file"
-.It HELP Ta "give help information"
-.It LIST Ta "give list files in a directory" Pq Dq Li "ls -lgA"
-.It MKD Ta "make a directory"
-.It MDTM Ta "show last modification time of file"
-.It MODE Ta "specify data transfer" Em mode
-.It NLST Ta "give name list of files in directory"
-.It NOOP Ta "do nothing"
-.It PASS Ta "specify password"
-.It PASV Ta "prepare for server-to-server transfer"
-.It PORT Ta "specify data connection port"
-.It PWD Ta "print the current working directory"
-.It QUIT Ta "terminate session"
-.It REST Ta "restart incomplete transfer"
-.It RETR Ta "retrieve a file"
-.It RMD Ta "remove a directory"
-.It RNFR Ta "specify rename-from file name"
-.It RNTO Ta "specify rename-to file name"
-.It SITE Ta "non-standard commands (see next section)"
-.It SIZE Ta "return size of file"
-.It STAT Ta "return status of server"
-.It STOR Ta "store a file"
-.It STOU Ta "store a file with a unique name"
-.It STRU Ta "specify data transfer" Em structure
-.It SYST Ta "show operating system type of server system"
-.It TYPE Ta "specify data transfer" Em type
-.It USER Ta "specify user name"
-.It XCUP Ta "change to parent of current working directory (deprecated)"
-.It XCWD Ta "change working directory (deprecated)"
-.It XMKD Ta "make a directory (deprecated)"
-.It XPWD Ta "print the current working directory (deprecated)"
-.It XRMD Ta "remove a directory (deprecated)"
-.El
-.Pp
-The following commands are specified by RFC2228.
-.Bl -column Request -offset indent
-.It AUTH Ta "authentication/security mechanism"
-.It ADAT Ta "authentication/security data"
-.It PROT Ta "data channel protection level"
-.It PBSZ Ta "protection buffer size"
-.It MIC Ta "integrity protected command"
-.It CONF Ta "confidentiality protected command"
-.It ENC Ta "privacy protected command"
-.It CCC Ta "clear command channel"
-.El
-.Pp
-The following non-standard or
-.Tn UNIX
-specific commands are supported
-by the
-SITE request.
-.Pp
-.Bl -column Request -offset indent
-.It UMASK Ta change umask, (e.g.
-.Ic "SITE UMASK 002" )
-.It IDLE Ta set idle-timer, (e.g.
-.Ic "SITE IDLE 60" )
-.It CHMOD Ta change mode of a file (e.g.
-.Ic "SITE CHMOD 755 filename" )
-.It FIND Ta quickly find a specific file with GNU
-.Xr locate 1 .
-.It HELP Ta give help information.
-.El
-.Pp
-The following Kerberos related site commands are understood.
-.Bl -column Request -offset indent
-.It KAUTH Ta obtain remote tickets.
-.It KLIST Ta show remote tickets
-.El
-.Pp
-The remaining ftp requests specified in Internet RFC 959
-are
-recognized, but not implemented.
-MDTM and SIZE are not specified in RFC 959, but will appear in the
-next updated FTP RFC.
-.Pp
-The ftp server will abort an active file transfer only when the
-ABOR
-command is preceded by a Telnet "Interrupt Process" (IP)
-signal and a Telnet "Synch" signal in the command Telnet stream,
-as described in Internet RFC 959.
-If a
-STAT
-command is received during a data transfer, preceded by a Telnet IP
-and Synch, transfer status will be returned.
-.Pp
-.Nm Ftpd
-interprets file names according to the
-.Dq globbing
-conventions used by
-.Xr csh 1 .
-This allows users to use the metacharacters
-.Dq Li \&*?[]{}~ .
-.Pp
-.Nm Ftpd
-authenticates users according to these rules.
-.Pp
-.Bl -enum -offset indent
-.It
-If Kerberos authentication is used, the user must pass valid tickets
-and the principal must be allowed to login as the remote user.
-.It
-The login name must be in the password data base, and not have a null
-password (if Kerberos is used the password field is not checked). In
-this case a password must be provided by the client before any file
-operations may be performed. If the user has an OTP key, the response
-from a successful USER command will include an OTP challenge. The
-client may choose to respond with a PASS command giving either a
-standard password or an OTP one-time password. The server will
-automatically determine which type of password it has been given and
-attempt to authenticate accordingly. See
-.Xr otp 1
-for more information on OTP authentication.
-.It
-The login name must not appear in the file
-.Pa /etc/ftpusers .
-.It
-The user must have a standard shell returned by
-.Xr getusershell 3 .
-.It
-If the user name appears in the file
-.Pa /etc/ftpchroot
-the session's root will be changed to the user's login directory by
-.Xr chroot 2
-as for an
-.Dq anonymous
-or
-.Dq ftp
-account (see next item). However, the user must still supply a password.
-This feature is intended as a compromise between a fully anonymous account
-and a fully privileged account. The account should also be set up as for an
-anonymous account.
-.It
-If the user name is
-.Dq anonymous
-or
-.Dq ftp ,
-an
-anonymous ftp account must be present in the password
-file (user
-.Dq ftp ) .
-In this case the user is allowed
-to log in by specifying any password (by convention an email address for
-the user should be used as the password).
-.El
-.Pp
-In the last case,
-.Nm ftpd
-takes special measures to restrict the client's access privileges.
-The server performs a
-.Xr chroot 2
-to the home directory of the
-.Dq ftp
-user.
-In order that system security is not breached, it is recommended
-that the
-.Dq ftp
-subtree be constructed with care, consider following these guidelines
-for anonymous ftp.
-.Pp
-In general all files should be owned by
-.Dq root ,
-and have non-write permissions (644 or 755 depending on the kind of
-file). No files should be owned or writable by
-.Dq ftp
-(possibly with exception for the
-.Pa ~ftp/incoming ,
-as specified below).
-.Bl -tag -width "~ftp/pub" -offset indent
-.It Pa ~ftp
-The
-.Dq ftp
-homedirectory should be owned by root.
-.It Pa ~ftp/bin
-The directory for external programs (such as
-.Xr ls 1 ) .
-These programs must either be statically linked, or you must setup an
-environment for dynamic linking when running chrooted.
-These programs will be used if present:
-.Bl -tag -width "locate" -offset indent
-.It ls
-Used when listing files.
-.It compress
-When retrieving a filename that ends in
-.Pa .Z ,
-and that file isn't present,
-.Nm
-will try to find the filename without
-.Pa .Z
-and compress it on the fly.
-.It gzip
-Same as compress, just with files ending in
-.Pa .gz .
-.It gtar
-Enables retrieval of whole directories as files ending in
-.Pa .tar .
-Can also be combined with compression. You must use GNU Tar (or some
-other that supports the
-.Fl z
-and
-.Fl Z
-flags).
-.It locate
-Will enable ``fast find'' with the
-.Ic SITE FIND
-command. You must also create a
-.Pa locatedb
-file in
-.Pa ~ftp/etc .
-.El
-.It Pa ~ftp/etc
-If you put copies of the
-.Xr passwd 5
-and
-.Xr group 5
-files here, ls will be able to produce owner names rather than
-numbers. Remember to remove any passwords from these files.
-.Pp
-The file
-.Pa motd ,
-if present, will be printed after a successful login.
-.It Pa ~ftp/dev
-Put a copy of
-.Xr /dev/null 7
-here.
-.It Pa ~ftp/pub
-Traditional place to put whatever you want to make public.
-.El
-.Pp
-If you want guests to be able to upload files, create a
-.Pa ~ftp/incoming
-directory owned by
-.Dq root ,
-and group
-.Dq ftp
-with mode 730 (make sure
-.Dq ftp
-is member of group
-.Dq ftp ) .
-The following restrictions apply to anonymous users:
-.Bl -bullet
-.It
-Directories created will have mode 700.
-.It
-Uploaded files will be created with an umask of 777, if not changed
-with the
-.Fl g
-option.
-.It
-These command are not accessible:
-.Ic DELE , RMD , RNTO , RNFR ,
-.Ic SITE UMASK ,
-and
-.Ic SITE CHMOD .
-.It
-Filenames must start with an alpha-numeric character, and consist of
-alpha-numeric characters or any of the following:
-.Li \&+
-(plus),
-.Li \&-
-(minus),
-.Li \&=
-(equal),
-.Li \&_
-(underscore),
-.Li \&.
-(period), and
-.Li \&,
-(comma).
-.El
-.Sh FILES
-.Bl -tag -width /etc/ftpwelcome -compact
-.It Pa /etc/ftpusers
-Access list for users.
-.It Pa /etc/ftpchroot
-List of normal users who should be chroot'd.
-.It Pa /etc/ftpwelcome
-Welcome notice.
-.It Pa /etc/motd
-Welcome notice after login.
-.It Pa /etc/nologin
-Displayed and access refused.
-.It Pa ~/.klogin
-Login access for Kerberos.
-.El
-.Sh SEE ALSO
-.Xr ftp 1 ,
-.Xr otp 1 ,
-.Xr getusershell 3 ,
-.Xr ftpusers 5 ,
-.Xr syslogd 8
-.Sh STANDARDS
-.Bl -tag -compact -width "RFC 1938"
-.It Cm RFC 959
-FTP PROTOCOL SPECIFICATION
-.It Cm RFC 1938
-OTP Specification
-.It Cm RFC 2228
-FTP Security Extensions.
-.El
-.Sh BUGS
-The server must run as the super-user
-to create sockets with privileged port numbers. It maintains
-an effective user id of the logged in user, reverting to
-the super-user only when binding addresses to sockets. The
-possible security holes have been extensively
-scrutinized, but are possibly incomplete.
-.Sh HISTORY
-The
-.Nm
-command appeared in
-.Bx 4.2 .
diff --git a/appl/ftp/ftpd/ftpd.c b/appl/ftp/ftpd/ftpd.c
deleted file mode 100644
index 5be67c866232..000000000000
--- a/appl/ftp/ftpd/ftpd.c
+++ /dev/null
@@ -1,2367 +0,0 @@
-/*
- * Copyright (c) 1985, 1988, 1990, 1992, 1993, 1994
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#define FTP_NAMES
-#include "ftpd_locl.h"
-#ifdef KRB5
-#include <krb5.h>
-#endif
-#include "getarg.h"
-
-RCSID("$Id$");
-
-static char version[] = "Version 6.00";
-
-extern off_t restart_point;
-extern char cbuf[];
-
-struct sockaddr_storage ctrl_addr_ss;
-struct sockaddr *ctrl_addr = (struct sockaddr *)&ctrl_addr_ss;
-
-struct sockaddr_storage data_source_ss;
-struct sockaddr *data_source = (struct sockaddr *)&data_source_ss;
-
-struct sockaddr_storage data_dest_ss;
-struct sockaddr *data_dest = (struct sockaddr *)&data_dest_ss;
-
-struct sockaddr_storage his_addr_ss;
-struct sockaddr *his_addr = (struct sockaddr *)&his_addr_ss;
-
-struct sockaddr_storage pasv_addr_ss;
-struct sockaddr *pasv_addr = (struct sockaddr *)&pasv_addr_ss;
-
-int data;
-int logged_in;
-struct passwd *pw;
-int debug = 0;
-int ftpd_timeout = 900; /* timeout after 15 minutes of inactivity */
-int maxtimeout = 7200;/* don't allow idle time to be set beyond 2 hours */
-int restricted_data_ports = 1;
-int logging;
-int guest;
-int dochroot;
-int type;
-int form;
-int stru; /* avoid C keyword */
-int mode;
-int usedefault = 1; /* for data transfers */
-int pdata = -1; /* for passive mode */
-int allow_insecure_oob = 1;
-static int transflag;
-static int urgflag;
-off_t file_size;
-off_t byte_count;
-#if !defined(CMASK) || CMASK == 0
-#undef CMASK
-#define CMASK 027
-#endif
-int defumask = CMASK; /* default umask value */
-int guest_umask = 0777; /* Paranoia for anonymous users */
-char tmpline[10240];
-char hostname[MaxHostNameLen];
-char remotehost[MaxHostNameLen];
-static char ttyline[20];
-int paranoid = 1;
-
-#define AUTH_PLAIN (1 << 0) /* allow sending passwords */
-#define AUTH_OTP (1 << 1) /* passwords are one-time */
-#define AUTH_FTP (1 << 2) /* allow anonymous login */
-
-static int auth_level = 0; /* Only allow kerberos login by default */
-
-/*
- * Timeout intervals for retrying connections
- * to hosts that don't accept PORT cmds. This
- * is a kludge, but given the problems with TCP...
- */
-#define SWAITMAX 90 /* wait at most 90 seconds */
-#define SWAITINT 5 /* interval between retries */
-
-int swaitmax = SWAITMAX;
-int swaitint = SWAITINT;
-
-#ifdef HAVE_SETPROCTITLE
-char proctitle[BUFSIZ]; /* initial part of title */
-#endif /* HAVE_SETPROCTITLE */
-
-#define LOGCMD(cmd, file) \
- if (logging > 1) \
- syslog(LOG_INFO,"%s %s%s", cmd, \
- *(file) == '/' ? "" : curdir(), file);
-#define LOGCMD2(cmd, file1, file2) \
- if (logging > 1) \
- syslog(LOG_INFO,"%s %s%s %s%s", cmd, \
- *(file1) == '/' ? "" : curdir(), file1, \
- *(file2) == '/' ? "" : curdir(), file2);
-#define LOGBYTES(cmd, file, cnt) \
- if (logging > 1) { \
- if (cnt == (off_t)-1) \
- syslog(LOG_INFO,"%s %s%s", cmd, \
- *(file) == '/' ? "" : curdir(), file); \
- else \
- syslog(LOG_INFO, "%s %s%s = %ld bytes", \
- cmd, (*(file) == '/') ? "" : curdir(), file, (long)cnt); \
- }
-
-static void ack (char *);
-static void myoob (int);
-static int handleoobcmd(void);
-static int checkuser (char *, char *);
-static int checkaccess (char *);
-static FILE *dataconn (const char *, off_t, const char *);
-static void dolog (struct sockaddr *, int);
-static void end_login (void);
-static FILE *getdatasock (const char *, int);
-static char *gunique (char *);
-static RETSIGTYPE lostconn (int);
-static int receive_data (FILE *, FILE *);
-static void send_data (FILE *, FILE *);
-static struct passwd * sgetpwnam (char *);
-
-static char *
-curdir(void)
-{
- static char path[MaxPathLen+1]; /* path + '/' + '\0' */
-
- if (getcwd(path, sizeof(path)-1) == NULL)
- return ("");
- if (path[1] != '\0') /* special case for root dir. */
- strlcat(path, "/", sizeof(path));
- /* For guest account, skip / since it's chrooted */
- return (guest ? path+1 : path);
-}
-
-#ifndef LINE_MAX
-#define LINE_MAX 1024
-#endif
-
-static int
-parse_auth_level(char *str)
-{
- char *p;
- int ret = 0;
- char *foo = NULL;
-
- for(p = strtok_r(str, ",", &foo);
- p;
- p = strtok_r(NULL, ",", &foo)) {
- if(strcmp(p, "user") == 0)
- ;
-#ifdef OTP
- else if(strcmp(p, "otp") == 0)
- ret |= AUTH_PLAIN|AUTH_OTP;
-#endif
- else if(strcmp(p, "ftp") == 0 ||
- strcmp(p, "safe") == 0)
- ret |= AUTH_FTP;
- else if(strcmp(p, "plain") == 0)
- ret |= AUTH_PLAIN;
- else if(strcmp(p, "none") == 0)
- ret |= AUTH_PLAIN|AUTH_FTP;
- else
- warnx("bad value for -a: `%s'", p);
- }
- return ret;
-}
-
-/*
- * Print usage and die.
- */
-
-static int interactive_flag;
-static char *guest_umask_string;
-static char *port_string;
-static char *umask_string;
-static char *auth_string;
-
-int use_builtin_ls = -1;
-
-static int help_flag;
-static int version_flag;
-
-static const char *good_chars = "+-=_,.";
-
-struct getargs args[] = {
- { NULL, 'a', arg_string, &auth_string, "required authentication" },
- { NULL, 'i', arg_flag, &interactive_flag, "don't assume stdin is a socket" },
- { NULL, 'p', arg_string, &port_string, "what port to listen to" },
- { NULL, 'g', arg_string, &guest_umask_string, "umask for guest logins" },
- { NULL, 'l', arg_counter, &logging, "log more stuff", "" },
- { NULL, 't', arg_integer, &ftpd_timeout, "initial timeout" },
- { NULL, 'T', arg_integer, &maxtimeout, "max timeout" },
- { NULL, 'u', arg_string, &umask_string, "umask for user logins" },
- { NULL, 'U', arg_negative_flag, &restricted_data_ports, "don't use high data ports" },
- { NULL, 'd', arg_flag, &debug, "enable debugging" },
- { NULL, 'v', arg_flag, &debug, "enable debugging" },
- { "builtin-ls", 'B', arg_flag, &use_builtin_ls, "use built-in ls to list files" },
- { "good-chars", 0, arg_string, &good_chars, "allowed anonymous upload filename chars" },
- { "insecure-oob", 'I', arg_negative_flag, &allow_insecure_oob, "don't allow insecure OOB ABOR/STAT" },
-#ifdef KRB5
- { "gss-bindings", 0, arg_flag, &ftp_do_gss_bindings, "Require GSS-API bindings", NULL},
-#endif
- { "version", 0, arg_flag, &version_flag },
- { "help", 'h', arg_flag, &help_flag }
-};
-
-static int num_args = sizeof(args) / sizeof(args[0]);
-
-static void
-usage (int code)
-{
- arg_printusage(args, num_args, NULL, "");
- exit (code);
-}
-
-/* output contents of a file */
-static int
-show_file(const char *file, int code)
-{
- FILE *f;
- char buf[128];
-
- f = fopen(file, "r");
- if(f == NULL)
- return -1;
- while(fgets(buf, sizeof(buf), f)){
- buf[strcspn(buf, "\r\n")] = '\0';
- lreply(code, "%s", buf);
- }
- fclose(f);
- return 0;
-}
-
-int
-main(int argc, char **argv)
-{
- socklen_t his_addr_len, ctrl_addr_len;
- int on = 1;
- int port;
- struct servent *sp;
-
- int optind = 0;
-
- setprogname (argv[0]);
-
- if(getarg(args, num_args, argc, argv, &optind))
- usage(1);
-
- if(help_flag)
- usage(0);
-
- if(version_flag) {
- print_version(NULL);
- exit(0);
- }
-
- if(auth_string)
- auth_level = parse_auth_level(auth_string);
- {
- char *p;
- long val = 0;
-
- if(guest_umask_string) {
- val = strtol(guest_umask_string, &p, 8);
- if (*p != '\0' || val < 0)
- warnx("bad value for -g");
- else
- guest_umask = val;
- }
- if(umask_string) {
- val = strtol(umask_string, &p, 8);
- if (*p != '\0' || val < 0)
- warnx("bad value for -u");
- else
- defumask = val;
- }
- }
- sp = getservbyname("ftp", "tcp");
- if(sp)
- port = sp->s_port;
- else
- port = htons(21);
- if(port_string) {
- sp = getservbyname(port_string, "tcp");
- if(sp)
- port = sp->s_port;
- else
- if(isdigit((unsigned char)port_string[0]))
- port = htons(atoi(port_string));
- else
- warnx("bad value for -p");
- }
-
- if (maxtimeout < ftpd_timeout)
- maxtimeout = ftpd_timeout;
-
-#if 0
- if (ftpd_timeout > maxtimeout)
- ftpd_timeout = maxtimeout;
-#endif
-
- if(interactive_flag)
- mini_inetd(port, NULL);
-
- /*
- * LOG_NDELAY sets up the logging connection immediately,
- * necessary for anonymous ftp's that chroot and can't do it later.
- */
- openlog("ftpd", LOG_PID | LOG_NDELAY, LOG_FTP);
- his_addr_len = sizeof(his_addr_ss);
- if (getpeername(STDIN_FILENO, his_addr, &his_addr_len) < 0) {
- syslog(LOG_ERR, "getpeername (%s): %m",argv[0]);
- exit(1);
- }
- ctrl_addr_len = sizeof(ctrl_addr_ss);
- if (getsockname(STDIN_FILENO, ctrl_addr, &ctrl_addr_len) < 0) {
- syslog(LOG_ERR, "getsockname (%s): %m",argv[0]);
- exit(1);
- }
-#if defined(IP_TOS)
- if (ctrl_addr->sa_family == AF_INET)
- socket_set_tos(STDIN_FILENO, IP_TOS);
-#endif
- data_source->sa_family = ctrl_addr->sa_family;
- socket_set_port (data_source,
- htons(ntohs(socket_get_port(ctrl_addr)) - 1));
-
- /* set this here so it can be put in wtmp */
- snprintf(ttyline, sizeof(ttyline), "ftp%u", (unsigned)getpid());
-
-
- /* freopen(_PATH_DEVNULL, "w", stderr); */
- signal(SIGPIPE, lostconn);
- signal(SIGCHLD, SIG_IGN);
-#ifdef SIGURG
- if (signal(SIGURG, myoob) == SIG_ERR)
- syslog(LOG_ERR, "signal: %m");
-#endif
-
- /* Try to handle urgent data inline */
-#if defined(SO_OOBINLINE) && defined(HAVE_SETSOCKOPT)
- if (setsockopt(0, SOL_SOCKET, SO_OOBINLINE, (void *)&on,
- sizeof(on)) < 0)
- syslog(LOG_ERR, "setsockopt: %m");
-#endif
-
-#ifdef F_SETOWN
- if (fcntl(fileno(stdin), F_SETOWN, getpid()) == -1)
- syslog(LOG_ERR, "fcntl F_SETOWN: %m");
-#endif
- dolog(his_addr, his_addr_len);
- /*
- * Set up default state
- */
- data = -1;
- type = TYPE_A;
- form = FORM_N;
- stru = STRU_F;
- mode = MODE_S;
- tmpline[0] = '\0';
-
- /* If logins are disabled, print out the message. */
- if(show_file(_PATH_NOLOGIN, 530) == 0) {
- reply(530, "System not available.");
- exit(0);
- }
- show_file(_PATH_FTPWELCOME, 220);
- /* reply(220,) must follow */
- gethostname(hostname, sizeof(hostname));
-
- reply(220, "%s FTP server (%s"
-#ifdef KRB5
- "+%s"
-#endif
- ") ready.", hostname, version
-#ifdef KRB5
- ,heimdal_version
-#endif
- );
-
- for (;;)
- yyparse();
- /* NOTREACHED */
-}
-
-static RETSIGTYPE
-lostconn(int signo)
-{
-
- if (debug)
- syslog(LOG_DEBUG, "lost connection");
- dologout(-1);
-}
-
-/*
- * Helper function for sgetpwnam().
- */
-static char *
-sgetsave(char *s)
-{
- char *new = strdup(s);
-
- if (new == NULL) {
- perror_reply(421, "Local resource failure: malloc");
- dologout(1);
- /* NOTREACHED */
- }
- return new;
-}
-
-/*
- * Save the result of a getpwnam. Used for USER command, since
- * the data returned must not be clobbered by any other command
- * (e.g., globbing).
- */
-static struct passwd *
-sgetpwnam(char *name)
-{
- static struct passwd save;
- struct passwd *p;
-
- if ((p = k_getpwnam(name)) == NULL)
- return (p);
- if (save.pw_name) {
- free(save.pw_name);
- free(save.pw_passwd);
- free(save.pw_gecos);
- free(save.pw_dir);
- free(save.pw_shell);
- }
- save = *p;
- save.pw_name = sgetsave(p->pw_name);
- save.pw_passwd = sgetsave(p->pw_passwd);
- save.pw_gecos = sgetsave(p->pw_gecos);
- save.pw_dir = sgetsave(p->pw_dir);
- save.pw_shell = sgetsave(p->pw_shell);
- return (&save);
-}
-
-static int login_attempts; /* number of failed login attempts */
-static int askpasswd; /* had user command, ask for passwd */
-static char curname[10]; /* current USER name */
-#ifdef OTP
-OtpContext otp_ctx;
-#endif
-
-/*
- * USER command.
- * 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.
- * 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.
- */
-void
-user(char *name)
-{
- char *cp, *shell;
-
- if(auth_level == 0 && !sec_complete){
- reply(530, "No login allowed without authorization.");
- return;
- }
-
- if (logged_in) {
- if (guest) {
- reply(530, "Can't change user from guest login.");
- return;
- } else if (dochroot) {
- reply(530, "Can't change user from chroot user.");
- return;
- }
- end_login();
- }
-
- guest = 0;
- if (strcmp(name, "ftp") == 0 || strcmp(name, "anonymous") == 0) {
- if ((auth_level & AUTH_FTP) == 0 ||
- checkaccess("ftp") ||
- checkaccess("anonymous"))
- reply(530, "User %s access denied.", name);
- else if ((pw = sgetpwnam("ftp")) != NULL) {
- guest = 1;
- defumask = guest_umask; /* paranoia for incoming */
- askpasswd = 1;
- reply(331, "Guest login ok, type your name as password.");
- } else
- reply(530, "User %s unknown.", name);
- if (!askpasswd && logging) {
- char data_addr[256];
-
- if (inet_ntop (his_addr->sa_family,
- socket_get_address(his_addr),
- data_addr, sizeof(data_addr)) == NULL)
- strlcpy (data_addr, "unknown address",
- sizeof(data_addr));
-
- syslog(LOG_NOTICE,
- "ANONYMOUS FTP LOGIN REFUSED FROM %s(%s)",
- remotehost, data_addr);
- }
- return;
- }
- if((auth_level & AUTH_PLAIN) == 0 && !sec_complete){
- reply(530, "Only authorized and anonymous login allowed.");
- return;
- }
- if ((pw = sgetpwnam(name))) {
- if ((shell = pw->pw_shell) == NULL || *shell == 0)
- shell = _PATH_BSHELL;
- while ((cp = getusershell()) != NULL)
- if (strcmp(cp, shell) == 0)
- break;
- endusershell();
-
- if (cp == NULL || checkaccess(name)) {
- reply(530, "User %s access denied.", name);
- if (logging) {
- char data_addr[256];
-
- if (inet_ntop (his_addr->sa_family,
- socket_get_address(his_addr),
- data_addr,
- sizeof(data_addr)) == NULL)
- strlcpy (data_addr,
- "unknown address",
- sizeof(data_addr));
-
- syslog(LOG_NOTICE,
- "FTP LOGIN REFUSED FROM %s(%s), %s",
- remotehost,
- data_addr,
- name);
- }
- pw = (struct passwd *) NULL;
- return;
- }
- }
- if (logging)
- strlcpy(curname, name, sizeof(curname));
- if(sec_complete) {
- if(sec_userok(name) == 0) {
- do_login(232, name);
- sec_session(name);
- } else
- reply(530, "User %s access denied.", name);
- } else {
-#ifdef OTP
- char ss[256];
-
- if (otp_challenge(&otp_ctx, name, ss, sizeof(ss)) == 0) {
- reply(331, "Password %s for %s required.",
- ss, name);
- askpasswd = 1;
- } else
-#endif
- if ((auth_level & AUTH_OTP) == 0) {
- reply(331, "Password required for %s.", name);
- askpasswd = 1;
- } else {
-#ifdef OTP
- char *s;
-
- if ((s = otp_error (&otp_ctx)) != NULL)
- lreply(530, "OTP: %s", s);
-#endif
- reply(530,
- "Only authorized, anonymous"
-#ifdef OTP
- " and OTP "
-#endif
- "login allowed.");
- }
-
- }
- /*
- * Delay before reading passwd after first failed
- * attempt to slow down passwd-guessing programs.
- */
- if (login_attempts)
- sleep(login_attempts);
-}
-
-/*
- * Check if a user is in the file "fname"
- */
-static int
-checkuser(char *fname, char *name)
-{
- FILE *fd;
- int found = 0;
- char *p, line[BUFSIZ];
-
- if ((fd = fopen(fname, "r")) != NULL) {
- while (fgets(line, sizeof(line), fd) != NULL)
- if ((p = strchr(line, '\n')) != NULL) {
- *p = '\0';
- if (line[0] == '#')
- continue;
- if (strcmp(line, name) == 0) {
- found = 1;
- break;
- }
- }
- fclose(fd);
- }
- return (found);
-}
-
-
-/*
- * Determine whether a user has access, based on information in
- * _PATH_FTPUSERS. The users are listed one per line, with `allow'
- * or `deny' after the username. If anything other than `allow', or
- * just nothing, is given after the username, `deny' is assumed.
- *
- * If the user is not found in the file, but the pseudo-user `*' is,
- * the permission is taken from that line.
- *
- * This preserves the old semantics where if a user was listed in the
- * file he was denied, otherwise he was allowed.
- *
- * Return 1 if the user is denied, or 0 if he is allowed. */
-
-static int
-match(const char *pattern, const char *string)
-{
- return fnmatch(pattern, string, FNM_NOESCAPE);
-}
-
-static int
-checkaccess(char *name)
-{
-#define ALLOWED 0
-#define NOT_ALLOWED 1
- FILE *fd;
- int allowed = ALLOWED;
- char *user, *perm, line[BUFSIZ];
- char *foo;
-
- fd = fopen(_PATH_FTPUSERS, "r");
-
- if(fd == NULL)
- return allowed;
-
- while (fgets(line, sizeof(line), fd) != NULL) {
- foo = NULL;
- user = strtok_r(line, " \t\n", &foo);
- if (user == NULL || user[0] == '#')
- continue;
- perm = strtok_r(NULL, " \t\n", &foo);
- if (match(user, name) == 0){
- if(perm && strcmp(perm, "allow") == 0)
- allowed = ALLOWED;
- else
- allowed = NOT_ALLOWED;
- break;
- }
- }
- fclose(fd);
- return allowed;
-}
-#undef ALLOWED
-#undef NOT_ALLOWED
-
-
-int do_login(int code, char *passwd)
-{
- login_attempts = 0; /* this time successful */
- if (setegid((gid_t)pw->pw_gid) < 0) {
- reply(550, "Can't set gid.");
- return -1;
- }
- initgroups(pw->pw_name, pw->pw_gid);
-#if defined(KRB5)
- if(k_hasafs())
- k_setpag();
-#endif
-
- /* open wtmp before chroot */
- ftpd_logwtmp(ttyline, pw->pw_name, remotehost);
- logged_in = 1;
-
- dochroot = checkuser(_PATH_FTPCHROOT, pw->pw_name);
- if (guest) {
- /*
- * We MUST do a chdir() after the chroot. Otherwise
- * the old current directory will be accessible as "."
- * outside the new root!
- */
- if (chroot(pw->pw_dir) < 0 || chdir("/") < 0) {
- reply(550, "Can't set guest privileges.");
- return -1;
- }
- } else if (dochroot) {
- if (chroot(pw->pw_dir) < 0 || chdir("/") < 0) {
- reply(550, "Can't change root.");
- return -1;
- }
- } else if (chdir(pw->pw_dir) < 0) {
- if (chdir("/") < 0) {
- reply(530, "User %s: can't change directory to %s.",
- pw->pw_name, pw->pw_dir);
- return -1;
- } else
- lreply(code, "No directory! Logging in with home=/");
- }
- if (seteuid((uid_t)pw->pw_uid) < 0) {
- reply(550, "Can't set uid.");
- return -1;
- }
-
- if(use_builtin_ls == -1) {
- struct stat st;
- /* if /bin/ls exist and is a regular file, use it, otherwise
- use built-in ls */
- if(stat("/bin/ls", &st) == 0 &&
- S_ISREG(st.st_mode))
- use_builtin_ls = 0;
- else
- use_builtin_ls = 1;
- }
-
- /*
- * Display a login message, if it exists.
- * N.B. reply(code,) must follow the message.
- */
- show_file(_PATH_FTPLOGINMESG, code);
- if(show_file(_PATH_ISSUE_NET, code) != 0)
- show_file(_PATH_ISSUE, code);
- if (guest) {
- reply(code, "Guest login ok, access restrictions apply.");
-#ifdef HAVE_SETPROCTITLE
- snprintf (proctitle, sizeof(proctitle),
- "%s: anonymous/%s",
- remotehost,
- passwd);
- setproctitle("%s", proctitle);
-#endif /* HAVE_SETPROCTITLE */
- if (logging) {
- char data_addr[256];
-
- if (inet_ntop (his_addr->sa_family,
- socket_get_address(his_addr),
- data_addr, sizeof(data_addr)) == NULL)
- strlcpy (data_addr, "unknown address",
- sizeof(data_addr));
-
- syslog(LOG_INFO, "ANONYMOUS FTP LOGIN FROM %s(%s), %s",
- remotehost,
- data_addr,
- passwd);
- }
- } else {
- reply(code, "User %s logged in.", pw->pw_name);
-#ifdef HAVE_SETPROCTITLE
- snprintf(proctitle, sizeof(proctitle), "%s: %s", remotehost, pw->pw_name);
- setproctitle("%s", proctitle);
-#endif /* HAVE_SETPROCTITLE */
- if (logging) {
- char data_addr[256];
-
- if (inet_ntop (his_addr->sa_family,
- socket_get_address(his_addr),
- data_addr, sizeof(data_addr)) == NULL)
- strlcpy (data_addr, "unknown address",
- sizeof(data_addr));
-
- syslog(LOG_INFO, "FTP LOGIN FROM %s(%s) as %s",
- remotehost,
- data_addr,
- pw->pw_name);
- }
- }
- umask(defumask);
- return 0;
-}
-
-/*
- * Terminate login as previous user, if any, resetting state;
- * used when USER command is given or login fails.
- */
-static void
-end_login(void)
-{
-
- if (seteuid((uid_t)0) < 0)
- fatal("Failed to seteuid");
- if (logged_in)
- ftpd_logwtmp(ttyline, "", "");
- pw = NULL;
- logged_in = 0;
- guest = 0;
- dochroot = 0;
-}
-
-#ifdef KRB5
-static int
-krb5_verify(struct passwd *pwd, char *passwd)
-{
- krb5_context context;
- krb5_ccache id;
- krb5_principal princ;
- krb5_error_code ret;
-
- ret = krb5_init_context(&context);
- if(ret)
- return ret;
-
- ret = krb5_parse_name(context, pwd->pw_name, &princ);
- if(ret){
- krb5_free_context(context);
- return ret;
- }
- ret = krb5_cc_new_unique(context, "MEMORY", NULL, &id);
- if(ret){
- krb5_free_principal(context, princ);
- krb5_free_context(context);
- return ret;
- }
- ret = krb5_verify_user(context,
- princ,
- id,
- passwd,
- 1,
- NULL);
- krb5_free_principal(context, princ);
- if (k_hasafs()) {
- krb5_afslog_uid_home(context, id,NULL, NULL,pwd->pw_uid, pwd->pw_dir);
- }
- krb5_cc_destroy(context, id);
- krb5_free_context (context);
- if(ret)
- return ret;
- return 0;
-}
-#endif /* KRB5 */
-
-void
-pass(char *passwd)
-{
- int rval;
-
- /* some clients insists on sending a password */
- if (logged_in && askpasswd == 0){
- reply(230, "Password not necessary");
- return;
- }
-
- if (logged_in || askpasswd == 0) {
- reply(503, "Login with USER first.");
- return;
- }
- askpasswd = 0;
- rval = 1;
- if (!guest) { /* "ftp" is only account allowed no password */
- if (pw == NULL)
- rval = 1; /* failure below */
-#ifdef OTP
- else if (otp_verify_user (&otp_ctx, passwd) == 0) {
- rval = 0;
- }
-#endif
- else if((auth_level & AUTH_OTP) == 0) {
-#ifdef KRB5
- rval = krb5_verify(pw, passwd);
-#endif
- if (rval)
- rval = unix_verify_user(pw->pw_name, passwd);
- } else {
-#ifdef OTP
- char *s;
- if ((s = otp_error(&otp_ctx)) != NULL)
- lreply(530, "OTP: %s", s);
-#endif
- }
- memset (passwd, 0, strlen(passwd));
-
- /*
- * If rval == 1, the user failed the authentication
- * check above. If rval == 0, either Kerberos or
- * local authentication succeeded.
- */
- if (rval) {
- char data_addr[256];
-
- if (inet_ntop (his_addr->sa_family,
- socket_get_address(his_addr),
- data_addr, sizeof(data_addr)) == NULL)
- strlcpy (data_addr, "unknown address",
- sizeof(data_addr));
-
- reply(530, "Login incorrect.");
- if (logging)
- syslog(LOG_NOTICE,
- "FTP LOGIN FAILED FROM %s(%s), %s",
- remotehost,
- data_addr,
- curname);
- pw = NULL;
- if (login_attempts++ >= 5) {
- syslog(LOG_NOTICE,
- "repeated login failures from %s(%s)",
- remotehost,
- data_addr);
- exit(0);
- }
- return;
- }
- }
- if(!do_login(230, passwd))
- return;
-
- /* Forget all about it... */
- end_login();
-}
-
-void
-retrieve(const char *cmd, char *name)
-{
- FILE *fin = NULL, *dout;
- struct stat st;
- int (*closefunc) (FILE *);
- char line[BUFSIZ];
-
-
- if (cmd == 0) {
- fin = fopen(name, "r");
- closefunc = fclose;
- st.st_size = 0;
- if(fin == NULL){
- int save_errno = errno;
- struct cmds {
- const char *ext;
- const char *cmd;
- const char *rev_cmd;
- } cmds[] = {
- {".tar", "/bin/gtar cPf - %s", NULL},
- {".tar.gz", "/bin/gtar zcPf - %s", NULL},
- {".tar.Z", "/bin/gtar ZcPf - %s", NULL},
- {".gz", "/bin/gzip -c -- %s", "/bin/gzip -c -d -- %s"},
- {".Z", "/bin/compress -c -- %s", "/bin/uncompress -c -- %s"},
- {NULL, NULL}
- };
- struct cmds *p;
- for(p = cmds; p->ext; p++){
- char *tail = name + strlen(name) - strlen(p->ext);
- char c = *tail;
-
- if(strcmp(tail, p->ext) == 0 &&
- (*tail = 0) == 0 &&
- access(name, R_OK) == 0){
- snprintf (line, sizeof(line), p->cmd, name);
- *tail = c;
- break;
- }
- *tail = c;
- if (p->rev_cmd != NULL) {
- char *ext;
- int ret;
-
- ret = asprintf(&ext, "%s%s", name, p->ext);
- if (ret != -1) {
- if (access(ext, R_OK) == 0) {
- snprintf (line, sizeof(line),
- p->rev_cmd, ext);
- free(ext);
- break;
- }
- free(ext);
- }
- }
-
- }
- if(p->ext){
- fin = ftpd_popen(line, "r", 0, 0);
- closefunc = ftpd_pclose;
- st.st_size = -1;
- cmd = line;
- } else
- errno = save_errno;
- }
- } else {
- snprintf(line, sizeof(line), cmd, name);
- name = line;
- fin = ftpd_popen(line, "r", 1, 0);
- closefunc = ftpd_pclose;
- st.st_size = -1;
- }
- if (fin == NULL) {
- if (errno != 0) {
- perror_reply(550, name);
- if (cmd == 0) {
- LOGCMD("get", name);
- }
- }
- return;
- }
- byte_count = -1;
- if (cmd == 0){
- if(fstat(fileno(fin), &st) < 0 || !S_ISREG(st.st_mode)) {
- reply(550, "%s: not a plain file.", name);
- goto done;
- }
- }
- if (restart_point) {
- if (type == TYPE_A) {
- off_t i, n;
- int c;
-
- n = restart_point;
- i = 0;
- while (i++ < n) {
- if ((c=getc(fin)) == EOF) {
- perror_reply(550, name);
- goto done;
- }
- if (c == '\n')
- i++;
- }
- } else if (lseek(fileno(fin), restart_point, SEEK_SET) < 0) {
- perror_reply(550, name);
- goto done;
- }
- }
- dout = dataconn(name, st.st_size, "w");
- if (dout == NULL)
- goto done;
- set_buffer_size(fileno(dout), 0);
- send_data(fin, dout);
- fclose(dout);
- data = -1;
- pdata = -1;
-done:
- if (cmd == 0)
- LOGBYTES("get", name, byte_count);
- (*closefunc)(fin);
-}
-
-/* filename sanity check */
-
-int
-filename_check(char *filename)
-{
- char *p;
-
- p = strrchr(filename, '/');
- if(p)
- filename = p + 1;
-
- p = filename;
-
- if(isalnum((unsigned char)*p)){
- p++;
- while(*p && (isalnum((unsigned char)*p) || strchr(good_chars, (unsigned char)*p)))
- p++;
- if(*p == '\0')
- return 0;
- }
- lreply(553, "\"%s\" is not an acceptable filename.", filename);
- lreply(553, "The filename must start with an alphanumeric "
- "character and must only");
- reply(553, "consist of alphanumeric characters or any of the following: %s",
- good_chars);
- return 1;
-}
-
-void
-do_store(char *name, char *mode, int unique)
-{
- FILE *fout, *din;
- struct stat st;
- int (*closefunc) (FILE *);
-
- if(guest && filename_check(name))
- return;
- if (unique) {
- char *uname;
- if (stat(name, &st) == 0) {
- if ((uname = gunique(name)) == NULL)
- return;
- name = uname;
- }
- LOGCMD(*mode == 'w' ? "put" : "append", name);
- }
-
- if (restart_point)
- mode = "r+";
- fout = fopen(name, mode);
- closefunc = fclose;
- if (fout == NULL) {
- perror_reply(553, name);
- LOGCMD(*mode == 'w' ? "put" : "append", name);
- return;
- }
- byte_count = -1;
- if (restart_point) {
- if (type == TYPE_A) {
- off_t i, n;
- int c;
-
- n = restart_point;
- i = 0;
- while (i++ < n) {
- if ((c=getc(fout)) == EOF) {
- perror_reply(550, name);
- goto done;
- }
- if (c == '\n')
- i++;
- }
- /*
- * We must do this seek to "current" position
- * because we are changing from reading to
- * writing.
- */
- if (fseek(fout, 0L, SEEK_CUR) < 0) {
- perror_reply(550, name);
- goto done;
- }
- } else if (lseek(fileno(fout), restart_point, SEEK_SET) < 0) {
- perror_reply(550, name);
- goto done;
- }
- }
- din = dataconn(name, (off_t)-1, "r");
- if (din == NULL)
- goto done;
- set_buffer_size(fileno(din), 1);
- if (receive_data(din, fout) == 0) {
- if((*closefunc)(fout) < 0)
- perror_reply(552, name);
- else {
- if (unique)
- reply(226, "Transfer complete (unique file name:%s).",
- name);
- else
- reply(226, "Transfer complete.");
- }
- } else
- (*closefunc)(fout);
- fclose(din);
- data = -1;
- pdata = -1;
-done:
- LOGBYTES(*mode == 'w' ? "put" : "append", name, byte_count);
-}
-
-static FILE *
-getdatasock(const char *mode, int domain)
-{
- int s, t, tries;
-
- if (data >= 0)
- return (fdopen(data, mode));
- if (seteuid(0) < 0)
- fatal("Failed to seteuid");
- s = socket(domain, SOCK_STREAM, 0);
- if (s < 0)
- goto bad;
- socket_set_reuseaddr (s, 1);
- /* anchor socket to avoid multi-homing problems */
- socket_set_address_and_port (data_source,
- socket_get_address (ctrl_addr),
- socket_get_port (data_source));
-
- for (tries = 1; ; tries++) {
- if (bind(s, data_source,
- socket_sockaddr_size (data_source)) >= 0)
- break;
- if (errno != EADDRINUSE || tries > 10)
- goto bad;
- sleep(tries);
- }
- if (seteuid(pw->pw_uid) < 0)
- fatal("Failed to seteuid");
-#ifdef IPTOS_THROUGHPUT
- socket_set_tos (s, IPTOS_THROUGHPUT);
-#endif
- return (fdopen(s, mode));
-bad:
- /* Return the real value of errno (close may change it) */
- t = errno;
- if (seteuid((uid_t)pw->pw_uid) < 0)
- fatal("Failed to seteuid");
- close(s);
- errno = t;
- return (NULL);
-}
-
-static int
-accept_with_timeout(int socket,
- struct sockaddr *address,
- socklen_t *address_len,
- struct timeval *timeout)
-{
- int ret;
- fd_set rfd;
- FD_ZERO(&rfd);
- FD_SET(socket, &rfd);
- ret = select(socket + 1, &rfd, NULL, NULL, timeout);
- if(ret < 0)
- return ret;
- if(ret == 0) {
- errno = ETIMEDOUT;
- return -1;
- }
- return accept(socket, address, address_len);
-}
-
-static FILE *
-dataconn(const char *name, off_t size, const char *mode)
-{
- char sizebuf[32];
- FILE *file;
- int domain, retry = 0;
-
- file_size = size;
- byte_count = 0;
- if (size >= 0)
- snprintf(sizebuf, sizeof(sizebuf), " (%ld bytes)", (long)size);
- else
- *sizebuf = '\0';
- if (pdata >= 0) {
- struct sockaddr_storage from_ss;
- struct sockaddr *from = (struct sockaddr *)&from_ss;
- struct timeval timeout;
- int s;
- socklen_t fromlen = sizeof(from_ss);
-
- timeout.tv_sec = 15;
- timeout.tv_usec = 0;
- s = accept_with_timeout(pdata, from, &fromlen, &timeout);
- if (s < 0) {
- reply(425, "Can't open data connection.");
- close(pdata);
- pdata = -1;
- return (NULL);
- }
- close(pdata);
- pdata = s;
-#if defined(IPTOS_THROUGHPUT)
- if (from->sa_family == AF_INET)
- socket_set_tos(s, IPTOS_THROUGHPUT);
-#endif
- reply(150, "Opening %s mode data connection for '%s'%s.",
- type == TYPE_A ? "ASCII" : "BINARY", name, sizebuf);
- return (fdopen(pdata, mode));
- }
- if (data >= 0) {
- reply(125, "Using existing data connection for '%s'%s.",
- name, sizebuf);
- usedefault = 1;
- return (fdopen(data, mode));
- }
- if (usedefault)
- data_dest = his_addr;
- usedefault = 1;
- /*
- * Default to using the same socket type as the ctrl address,
- * unless we know the type of the data address.
- */
- domain = data_dest->sa_family;
- if (domain == PF_UNSPEC)
- domain = ctrl_addr->sa_family;
-
- file = getdatasock(mode, domain);
- if (file == NULL) {
- char data_addr[256];
-
- if (inet_ntop (data_source->sa_family,
- socket_get_address(data_source),
- data_addr, sizeof(data_addr)) == NULL)
- strlcpy (data_addr, "unknown address",
- sizeof(data_addr));
-
- reply(425, "Can't create data socket (%s,%d): %s.",
- data_addr,
- socket_get_port (data_source),
- strerror(errno));
- return (NULL);
- }
- data = fileno(file);
- while (connect(data, data_dest,
- socket_sockaddr_size(data_dest)) < 0) {
- if (errno == EADDRINUSE && retry < swaitmax) {
- sleep(swaitint);
- retry += swaitint;
- continue;
- }
- perror_reply(425, "Can't build data connection");
- fclose(file);
- data = -1;
- return (NULL);
- }
- reply(150, "Opening %s mode data connection for '%s'%s.",
- type == TYPE_A ? "ASCII" : "BINARY", name, sizebuf);
- return (file);
-}
-
-/*
- * Tranfer the contents of "instr" to "outstr" peer using the appropriate
- * encapsulation of the data subject * to Mode, Structure, and Type.
- *
- * NB: Form isn't handled.
- */
-static void
-send_data(FILE *instr, FILE *outstr)
-{
- int c, cnt, filefd, netfd;
- static char *buf;
- static size_t bufsize;
-
- transflag = 1;
- switch (type) {
-
- case TYPE_A:
- while ((c = getc(instr)) != EOF) {
- if (urgflag && handleoobcmd())
- return;
- byte_count++;
- if(c == '\n')
- sec_putc('\r', outstr);
- sec_putc(c, outstr);
- }
- sec_fflush(outstr);
- transflag = 0;
- urgflag = 0;
- if (ferror(instr))
- goto file_err;
- if (ferror(outstr))
- goto data_err;
- reply(226, "Transfer complete.");
- return;
-
- case TYPE_I:
- case TYPE_L:
-#if 0 /* XXX handle urg flag */
-#if defined(HAVE_MMAP) && !defined(NO_MMAP)
-#ifndef MAP_FAILED
-#define MAP_FAILED (-1)
-#endif
- {
- struct stat st;
- char *chunk;
- int in = fileno(instr);
- if(fstat(in, &st) == 0 && S_ISREG(st.st_mode)
- && st.st_size > 0) {
- /*
- * mmap zero bytes has potential of loosing, don't do it.
- */
- chunk = mmap(0, st.st_size, PROT_READ,
- MAP_SHARED, in, 0);
- if((void *)chunk != (void *)MAP_FAILED) {
- cnt = st.st_size - restart_point;
- sec_write(fileno(outstr), chunk + restart_point, cnt);
- if (munmap(chunk, st.st_size) < 0)
- warn ("munmap");
- sec_fflush(outstr);
- byte_count = cnt;
- transflag = 0;
- urgflag = 0;
- }
- }
- }
-#endif
-#endif
- if(transflag) {
- struct stat st;
-
- netfd = fileno(outstr);
- filefd = fileno(instr);
- buf = alloc_buffer (buf, &bufsize,
- fstat(filefd, &st) >= 0 ? &st : NULL);
- if (buf == NULL) {
- transflag = 0;
- urgflag = 0;
- perror_reply(451, "Local resource failure: malloc");
- return;
- }
- while ((cnt = read(filefd, buf, bufsize)) > 0 &&
- sec_write(netfd, buf, cnt) == cnt) {
- byte_count += cnt;
- if (urgflag && handleoobcmd())
- return;
- }
- sec_fflush(outstr); /* to end an encrypted stream */
- transflag = 0;
- urgflag = 0;
- if (cnt != 0) {
- if (cnt < 0)
- goto file_err;
- goto data_err;
- }
- }
- reply(226, "Transfer complete.");
- return;
- default:
- transflag = 0;
- urgflag = 0;
- reply(550, "Unimplemented TYPE %d in send_data", type);
- return;
- }
-
-data_err:
- transflag = 0;
- urgflag = 0;
- perror_reply(426, "Data connection");
- return;
-
-file_err:
- transflag = 0;
- urgflag = 0;
- perror_reply(551, "Error on input file");
-}
-
-/*
- * Transfer data from peer to "outstr" using the appropriate encapulation of
- * the data subject to Mode, Structure, and Type.
- *
- * N.B.: Form isn't handled.
- */
-static int
-receive_data(FILE *instr, FILE *outstr)
-{
- int cnt, bare_lfs = 0;
- static char *buf;
- static size_t bufsize;
- struct stat st;
-
- transflag = 1;
-
- buf = alloc_buffer (buf, &bufsize,
- fstat(fileno(outstr), &st) >= 0 ? &st : NULL);
- if (buf == NULL) {
- transflag = 0;
- urgflag = 0;
- perror_reply(451, "Local resource failure: malloc");
- return -1;
- }
-
- switch (type) {
-
- case TYPE_I:
- case TYPE_L:
- while ((cnt = sec_read(fileno(instr), buf, bufsize)) > 0) {
- if (write(fileno(outstr), buf, cnt) != cnt)
- goto file_err;
- byte_count += cnt;
- if (urgflag && handleoobcmd())
- return (-1);
- }
- if (cnt < 0)
- goto data_err;
- transflag = 0;
- urgflag = 0;
- return (0);
-
- case TYPE_E:
- reply(553, "TYPE E not implemented.");
- transflag = 0;
- urgflag = 0;
- return (-1);
-
- case TYPE_A:
- {
- char *p, *q;
- int cr_flag = 0;
- while ((cnt = sec_read(fileno(instr),
- buf + cr_flag,
- bufsize - cr_flag)) > 0){
- if (urgflag && handleoobcmd())
- return (-1);
- byte_count += cnt;
- cnt += cr_flag;
- cr_flag = 0;
- for(p = buf, q = buf; p < buf + cnt;) {
- if(*p == '\n')
- bare_lfs++;
- if(*p == '\r') {
- if(p == buf + cnt - 1){
- cr_flag = 1;
- p++;
- continue;
- }else if(p[1] == '\n'){
- *q++ = '\n';
- p += 2;
- continue;
- }
- }
- *q++ = *p++;
- }
- fwrite(buf, q - buf, 1, outstr);
- if(cr_flag)
- buf[0] = '\r';
- }
- if(cr_flag)
- putc('\r', outstr);
- fflush(outstr);
- if (ferror(instr))
- goto data_err;
- if (ferror(outstr))
- goto file_err;
- transflag = 0;
- urgflag = 0;
- if (bare_lfs) {
- lreply(226, "WARNING! %d bare linefeeds received in ASCII mode\r\n"
- " File may not have transferred correctly.\r\n",
- bare_lfs);
- }
- return (0);
- }
- default:
- reply(550, "Unimplemented TYPE %d in receive_data", type);
- transflag = 0;
- urgflag = 0;
- return (-1);
- }
-
-data_err:
- transflag = 0;
- urgflag = 0;
- perror_reply(426, "Data Connection");
- return (-1);
-
-file_err:
- transflag = 0;
- urgflag = 0;
- perror_reply(452, "Error writing file");
- return (-1);
-}
-
-void
-statfilecmd(char *filename)
-{
- FILE *fin;
- int c;
- char line[LINE_MAX];
-
- snprintf(line, sizeof(line), "/bin/ls -la -- %s", filename);
- fin = ftpd_popen(line, "r", 1, 0);
- lreply(211, "status of %s:", filename);
- while ((c = getc(fin)) != EOF) {
- if (c == '\n') {
- if (ferror(stdout)){
- perror_reply(421, "control connection");
- ftpd_pclose(fin);
- dologout(1);
- /* NOTREACHED */
- }
- if (ferror(fin)) {
- perror_reply(551, filename);
- ftpd_pclose(fin);
- return;
- }
- putc('\r', stdout);
- }
- putc(c, stdout);
- }
- ftpd_pclose(fin);
- reply(211, "End of Status");
-}
-
-void
-statcmd(void)
-{
-#if 0
- struct sockaddr_in *sin;
- u_char *a, *p;
-
- lreply(211, "%s FTP server (%s) status:", hostname, version);
- printf(" %s\r\n", version);
- printf(" Connected to %s", remotehost);
- if (!isdigit((unsigned char)remotehost[0]))
- printf(" (%s)", inet_ntoa(his_addr.sin_addr));
- printf("\r\n");
- if (logged_in) {
- if (guest)
- printf(" Logged in anonymously\r\n");
- else
- printf(" Logged in as %s\r\n", pw->pw_name);
- } else if (askpasswd)
- printf(" Waiting for password\r\n");
- else
- printf(" Waiting for user name\r\n");
- printf(" TYPE: %s", typenames[type]);
- if (type == TYPE_A || type == TYPE_E)
- printf(", FORM: %s", formnames[form]);
- if (type == TYPE_L)
-#if NBBY == 8
- printf(" %d", NBBY);
-#else
- printf(" %d", bytesize); /* need definition! */
-#endif
- printf("; STRUcture: %s; transfer MODE: %s\r\n",
- strunames[stru], modenames[mode]);
- if (data != -1)
- printf(" Data connection open\r\n");
- else if (pdata != -1) {
- printf(" in Passive mode");
- sin = &pasv_addr;
- goto printaddr;
- } else if (usedefault == 0) {
- printf(" PORT");
- sin = &data_dest;
-printaddr:
- a = (u_char *) &sin->sin_addr;
- p = (u_char *) &sin->sin_port;
-#define UC(b) (((int) b) & 0xff)
- printf(" (%d,%d,%d,%d,%d,%d)\r\n", UC(a[0]),
- UC(a[1]), UC(a[2]), UC(a[3]), UC(p[0]), UC(p[1]));
-#undef UC
- } else
- printf(" No data connection\r\n");
-#endif
- reply(211, "End of status");
-}
-
-void
-fatal(char *s)
-{
-
- reply(451, "Error in server: %s\n", s);
- reply(221, "Closing connection due to server error.");
- dologout(0);
- /* NOTREACHED */
-}
-
-static void
-int_reply(int, char *, const char *, va_list)
-#ifdef __GNUC__
-__attribute__ ((format (printf, 3, 0)))
-#endif
-;
-
-static void
-int_reply(int n, char *c, const char *fmt, va_list ap)
-{
- char buf[10240];
- char *p;
- p=buf;
- if(n){
- snprintf(p, sizeof(buf), "%d%s", n, c);
- p+=strlen(p);
- }
- vsnprintf(p, sizeof(buf) - strlen(p), fmt, ap);
- p+=strlen(p);
- snprintf(p, sizeof(buf) - strlen(p), "\r\n");
- p+=strlen(p);
- sec_fprintf(stdout, "%s", buf);
- fflush(stdout);
- if (debug)
- syslog(LOG_DEBUG, "<--- %s- ", buf);
-}
-
-void
-reply(int n, const char *fmt, ...)
-{
- va_list ap;
- va_start(ap, fmt);
- int_reply(n, " ", fmt, ap);
- delete_ftp_command();
- va_end(ap);
-}
-
-void
-lreply(int n, const char *fmt, ...)
-{
- va_list ap;
- va_start(ap, fmt);
- int_reply(n, "-", fmt, ap);
- va_end(ap);
-}
-
-void
-nreply(const char *fmt, ...)
-{
- va_list ap;
- va_start(ap, fmt);
- int_reply(0, NULL, fmt, ap);
- va_end(ap);
-}
-
-static void
-ack(char *s)
-{
-
- reply(250, "%s command successful.", s);
-}
-
-void
-nack(char *s)
-{
-
- reply(502, "%s command not implemented.", s);
-}
-
-void
-do_delete(char *name)
-{
- struct stat st;
-
- LOGCMD("delete", name);
- if (stat(name, &st) < 0) {
- perror_reply(550, name);
- return;
- }
- if (S_ISDIR(st.st_mode)) {
- if (rmdir(name) < 0) {
- perror_reply(550, name);
- return;
- }
- goto done;
- }
- if (unlink(name) < 0) {
- perror_reply(550, name);
- return;
- }
-done:
- ack("DELE");
-}
-
-void
-cwd(const char *path)
-{
-
- if (chdir(path) < 0)
- perror_reply(550, path);
- else
- ack("CWD");
-}
-
-void
-makedir(char *name)
-{
-
- LOGCMD("mkdir", name);
- if(guest && filename_check(name))
- return;
- if (mkdir(name, 0777) < 0)
- perror_reply(550, name);
- else{
- if(guest)
- chmod(name, 0700); /* guest has umask 777 */
- reply(257, "MKD command successful.");
- }
-}
-
-void
-removedir(char *name)
-{
-
- LOGCMD("rmdir", name);
- if (rmdir(name) < 0)
- perror_reply(550, name);
- else
- ack("RMD");
-}
-
-void
-pwd(void)
-{
- char path[MaxPathLen];
- char *ret;
-
- /* SunOS has a broken getcwd that does popen(pwd) (!!!), this
- * failes miserably when running chroot
- */
- ret = getcwd(path, sizeof(path));
- if (ret == NULL)
- reply(550, "%s.", strerror(errno));
- else
- reply(257, "\"%s\" is current directory.", path);
-}
-
-char *
-renamefrom(char *name)
-{
- struct stat st;
-
- if (stat(name, &st) < 0) {
- perror_reply(550, name);
- return NULL;
- }
- reply(350, "File exists, ready for destination name");
- return (name);
-}
-
-void
-renamecmd(char *from, char *to)
-{
-
- LOGCMD2("rename", from, to);
- if(guest && filename_check(to))
- return;
- if (rename(from, to) < 0)
- perror_reply(550, "rename");
- else
- ack("RNTO");
-}
-
-static void
-dolog(struct sockaddr *sa, int len)
-{
- getnameinfo_verified (sa, len, remotehost, sizeof(remotehost),
- NULL, 0, 0);
-#ifdef HAVE_SETPROCTITLE
- snprintf(proctitle, sizeof(proctitle), "%s: connected", remotehost);
- setproctitle("%s", proctitle);
-#endif /* HAVE_SETPROCTITLE */
-
- if (logging) {
- char data_addr[256];
-
- if (inet_ntop (his_addr->sa_family,
- socket_get_address(his_addr),
- data_addr, sizeof(data_addr)) == NULL)
- strlcpy (data_addr, "unknown address",
- sizeof(data_addr));
-
-
- syslog(LOG_INFO, "connection from %s(%s)",
- remotehost,
- data_addr);
- }
-}
-
-/*
- * Record logout in wtmp file
- * and exit with supplied status.
- */
-void
-dologout(int status)
-{
- transflag = 0;
- urgflag = 0;
- if (logged_in) {
-#if KRB5
- cond_kdestroy();
-#endif
- seteuid((uid_t)0); /* No need to check, we call exit() below */
- ftpd_logwtmp(ttyline, "", "");
- }
- /* beware of flushing buffers after a SIGPIPE */
-#ifdef XXX
- exit(status);
-#else
- _exit(status);
-#endif
-}
-
-void abor(void)
-{
- if (!transflag)
- return;
- reply(426, "Transfer aborted. Data connection closed.");
- reply(226, "Abort successful");
- transflag = 0;
-}
-
-static void
-myoob(int signo)
-{
- urgflag = 1;
-}
-
-static char *
-mec_space(char *p)
-{
- while(isspace(*(unsigned char *)p))
- p++;
- return p;
-}
-
-static int
-handleoobcmd(void)
-{
- char *cp;
-
- /* only process if transfer occurring */
- if (!transflag)
- return 0;
-
- urgflag = 0;
-
- cp = tmpline;
- if (ftpd_getline(cp, sizeof(tmpline)) == NULL) {
- reply(221, "You could at least say goodbye.");
- dologout(0);
- }
-
- if (strncasecmp("MIC", cp, 3) == 0) {
- mec(mec_space(cp + 3), prot_safe);
- } else if (strncasecmp("CONF", cp, 4) == 0) {
- mec(mec_space(cp + 4), prot_confidential);
- } else if (strncasecmp("ENC", cp, 3) == 0) {
- mec(mec_space(cp + 3), prot_private);
- } else if (!allow_insecure_oob) {
- reply(533, "Command protection level denied "
- "for paranoid reasons.");
- goto out;
- }
-
- if (secure_command())
- cp = ftp_command;
-
- if (strcasecmp(cp, "ABOR\r\n") == 0) {
- abor();
- } else if (strcasecmp(cp, "STAT\r\n") == 0) {
- if (file_size != (off_t) -1)
- reply(213, "Status: %ld of %ld bytes transferred",
- (long)byte_count,
- (long)file_size);
- else
- reply(213, "Status: %ld bytes transferred",
- (long)byte_count);
- }
-out:
- return (transflag == 0);
-}
-
-/*
- * Note: a response of 425 is not mentioned as a possible response to
- * the PASV command in RFC959. However, it has been blessed as
- * a legitimate response by Jon Postel in a telephone conversation
- * with Rick Adams on 25 Jan 89.
- */
-void
-pasv(void)
-{
- socklen_t len;
- char *p, *a;
- struct sockaddr_in *sin;
-
- if (ctrl_addr->sa_family != AF_INET) {
- reply(425,
- "You cannot do PASV with something that's not IPv4");
- return;
- }
-
- if(pdata != -1)
- close(pdata);
-
- pdata = socket(ctrl_addr->sa_family, SOCK_STREAM, 0);
- if (pdata < 0) {
- perror_reply(425, "Can't open passive connection");
- return;
- }
- pasv_addr->sa_family = ctrl_addr->sa_family;
- socket_set_address_and_port (pasv_addr,
- socket_get_address (ctrl_addr),
- 0);
- socket_set_portrange(pdata, restricted_data_ports,
- pasv_addr->sa_family);
- if (seteuid(0) < 0)
- fatal("Failed to seteuid");
- if (bind(pdata, pasv_addr, socket_sockaddr_size (pasv_addr)) < 0) {
- if (seteuid(pw->pw_uid) < 0)
- fatal("Failed to seteuid");
- goto pasv_error;
- }
- if (seteuid(pw->pw_uid) < 0)
- fatal("Failed to seteuid");
- len = sizeof(pasv_addr_ss);
- if (getsockname(pdata, pasv_addr, &len) < 0)
- goto pasv_error;
- if (listen(pdata, 1) < 0)
- goto pasv_error;
- sin = (struct sockaddr_in *)pasv_addr;
- a = (char *) &sin->sin_addr;
- p = (char *) &sin->sin_port;
-
-#define UC(b) (((int) b) & 0xff)
-
- reply(227, "Entering Passive Mode (%d,%d,%d,%d,%d,%d)", UC(a[0]),
- UC(a[1]), UC(a[2]), UC(a[3]), UC(p[0]), UC(p[1]));
- return;
-
-pasv_error:
- close(pdata);
- pdata = -1;
- perror_reply(425, "Can't open passive connection");
- return;
-}
-
-void
-epsv(char *proto)
-{
- socklen_t len;
-
- pdata = socket(ctrl_addr->sa_family, SOCK_STREAM, 0);
- if (pdata < 0) {
- perror_reply(425, "Can't open passive connection");
- return;
- }
- pasv_addr->sa_family = ctrl_addr->sa_family;
- socket_set_address_and_port (pasv_addr,
- socket_get_address (ctrl_addr),
- 0);
- socket_set_portrange(pdata, restricted_data_ports,
- pasv_addr->sa_family);
- if (seteuid(0) < 0)
- fatal("Failed to seteuid");
- if (bind(pdata, pasv_addr, socket_sockaddr_size (pasv_addr)) < 0) {
- if (seteuid(pw->pw_uid))
- fatal("Failed to seteuid");
- goto pasv_error;
- }
- if (seteuid(pw->pw_uid) < 0)
- fatal("Failed to seteuid");
- len = sizeof(pasv_addr_ss);
- if (getsockname(pdata, pasv_addr, &len) < 0)
- goto pasv_error;
- if (listen(pdata, 1) < 0)
- goto pasv_error;
-
- reply(229, "Entering Extended Passive Mode (|||%d|)",
- ntohs(socket_get_port (pasv_addr)));
- return;
-
-pasv_error:
- close(pdata);
- pdata = -1;
- perror_reply(425, "Can't open passive connection");
- return;
-}
-
-void
-eprt(char *str)
-{
- char *end;
- char sep;
- int af;
- int ret;
- int port;
-
- usedefault = 0;
- if (pdata >= 0) {
- close(pdata);
- pdata = -1;
- }
-
- sep = *str++;
- if (sep == '\0') {
- reply(500, "Bad syntax in EPRT");
- return;
- }
- af = strtol (str, &end, 0);
- if (af == 0 || *end != sep) {
- reply(500, "Bad syntax in EPRT");
- return;
- }
- str = end + 1;
- switch (af) {
-#ifdef HAVE_IPV6
- case 2 :
- data_dest->sa_family = AF_INET6;
- break;
-#endif
- case 1 :
- data_dest->sa_family = AF_INET;
- break;
- default :
- reply(522, "Network protocol %d not supported, use (1"
-#ifdef HAVE_IPV6
- ",2"
-#endif
- ")", af);
- return;
- }
- end = strchr (str, sep);
- if (end == NULL) {
- reply(500, "Bad syntax in EPRT");
- return;
- }
- *end = '\0';
- ret = inet_pton (data_dest->sa_family, str,
- socket_get_address (data_dest));
-
- if (ret != 1) {
- reply(500, "Bad address syntax in EPRT");
- return;
- }
- str = end + 1;
- port = strtol (str, &end, 0);
- if (port == 0 || *end != sep) {
- reply(500, "Bad port syntax in EPRT");
- return;
- }
- if (port < IPPORT_RESERVED) {
- reply(500, "Bad port in invalid range in EPRT");
- return;
- }
- socket_set_port (data_dest, htons(port));
-
- if (paranoid &&
- (data_dest->sa_family != his_addr->sa_family ||
- memcmp(socket_get_address(data_dest), socket_get_address(his_addr), socket_sockaddr_size(data_dest)) != 0))
- {
- reply(500, "Bad address in EPRT");
- }
- reply(200, "EPRT command successful.");
-}
-
-/*
- * Generate unique name for file with basename "local".
- * The file named "local" is already known to exist.
- * Generates failure reply on error.
- */
-static char *
-gunique(char *local)
-{
- static char new[MaxPathLen];
- struct stat st;
- int count;
- char *cp;
-
- cp = strrchr(local, '/');
- if (cp)
- *cp = '\0';
- if (stat(cp ? local : ".", &st) < 0) {
- perror_reply(553, cp ? local : ".");
- return NULL;
- }
- if (cp)
- *cp = '/';
- for (count = 1; count < 100; count++) {
- snprintf (new, sizeof(new), "%s.%d", local, count);
- if (stat(new, &st) < 0)
- return (new);
- }
- reply(452, "Unique file name cannot be created.");
- return (NULL);
-}
-
-/*
- * Format and send reply containing system error number.
- */
-void
-perror_reply(int code, const char *string)
-{
- reply(code, "%s: %s.", string, strerror(errno));
-}
-
-static char *onefile[] = {
- "",
- 0
-};
-
-void
-list_file(char *file)
-{
- if(use_builtin_ls) {
- FILE *dout;
- dout = dataconn(file, -1, "w");
- if (dout == NULL)
- return;
- set_buffer_size(fileno(dout), 0);
- if(builtin_ls(dout, file) == 0)
- reply(226, "Transfer complete.");
- else
- reply(451, "Requested action aborted. Local error in processing.");
- fclose(dout);
- data = -1;
- pdata = -1;
- } else {
-#ifdef HAVE_LS_A
- const char *cmd = "/bin/ls -lA %s";
-#else
- const char *cmd = "/bin/ls -la %s";
-#endif
- retrieve(cmd, file);
- }
-}
-
-void
-send_file_list(char *whichf)
-{
- struct stat st;
- DIR *dirp = NULL;
- struct dirent *dir;
- FILE *dout = NULL;
- char **dirlist, *dirname;
- int simple = 0;
- int freeglob = 0;
- glob_t gl;
- char buf[MaxPathLen];
-
- if (strpbrk(whichf, "~{[*?") != NULL) {
- int flags = GLOB_BRACE|GLOB_NOCHECK|GLOB_QUOTE|GLOB_TILDE|
-#ifdef GLOB_MAXPATH
- GLOB_MAXPATH
-#else
- GLOB_LIMIT
-#endif
- ;
-
- memset(&gl, 0, sizeof(gl));
- freeglob = 1;
- if (glob(whichf, flags, 0, &gl)) {
- reply(550, "not found");
- goto out;
- } else if (gl.gl_pathc == 0) {
- errno = ENOENT;
- perror_reply(550, whichf);
- goto out;
- }
- dirlist = gl.gl_pathv;
- } else {
- onefile[0] = whichf;
- dirlist = onefile;
- simple = 1;
- }
-
- while ((dirname = *dirlist++)) {
-
- if (urgflag && handleoobcmd())
- goto out;
-
- if (stat(dirname, &st) < 0) {
- /*
- * If user typed "ls -l", etc, and the client
- * used NLST, do what the user meant.
- */
- if (dirname[0] == '-' && *dirlist == NULL &&
- transflag == 0) {
- list_file(dirname);
- goto out;
- }
- perror_reply(550, whichf);
- goto out;
- }
-
- if (S_ISREG(st.st_mode)) {
- if (dout == NULL) {
- dout = dataconn("file list", (off_t)-1, "w");
- if (dout == NULL)
- goto out;
- transflag = 1;
- }
- snprintf(buf, sizeof(buf), "%s%s\n", dirname,
- type == TYPE_A ? "\r" : "");
- sec_write(fileno(dout), buf, strlen(buf));
- byte_count += strlen(dirname) + 1;
- continue;
- } else if (!S_ISDIR(st.st_mode))
- continue;
-
- if ((dirp = opendir(dirname)) == NULL)
- continue;
-
- while ((dir = readdir(dirp)) != NULL) {
- char nbuf[MaxPathLen];
-
- if (urgflag && handleoobcmd())
- goto out;
-
- if (!strcmp(dir->d_name, "."))
- continue;
- if (!strcmp(dir->d_name, ".."))
- continue;
-
- snprintf(nbuf, sizeof(nbuf), "%s/%s", dirname, dir->d_name);
-
- /*
- * We have to do a stat to insure it's
- * not a directory or special file.
- */
- if (simple || (stat(nbuf, &st) == 0 &&
- S_ISREG(st.st_mode))) {
- if (dout == NULL) {
- dout = dataconn("file list", (off_t)-1, "w");
- if (dout == NULL)
- goto out;
- transflag = 1;
- }
- if(strncmp(nbuf, "./", 2) == 0)
- snprintf(buf, sizeof(buf), "%s%s\n", nbuf +2,
- type == TYPE_A ? "\r" : "");
- else
- snprintf(buf, sizeof(buf), "%s%s\n", nbuf,
- type == TYPE_A ? "\r" : "");
- sec_write(fileno(dout), buf, strlen(buf));
- byte_count += strlen(nbuf) + 1;
- }
- }
- closedir(dirp);
- }
- if (dout == NULL)
- reply(550, "No files found.");
- else if (ferror(dout) != 0)
- perror_reply(550, "Data connection");
- else
- reply(226, "Transfer complete.");
-
-out:
- transflag = 0;
- if (dout != NULL){
- sec_write(fileno(dout), buf, 0); /* XXX flush */
-
- fclose(dout);
- }
- data = -1;
- pdata = -1;
- if (freeglob)
- globfree(&gl);
-}
-
-
-int
-find(char *pattern)
-{
- char line[1024];
- FILE *f;
-
- snprintf(line, sizeof(line),
- "/bin/locate -d %s -- %s",
- ftp_rooted("/etc/locatedb"),
- pattern);
- f = ftpd_popen(line, "r", 1, 1);
- if(f == NULL){
- perror_reply(550, "/bin/locate");
- return 1;
- }
- lreply(200, "Output from find.");
- while(fgets(line, sizeof(line), f)){
- if(line[strlen(line)-1] == '\n')
- line[strlen(line)-1] = 0;
- nreply("%s", line);
- }
- reply(200, "Done");
- ftpd_pclose(f);
- return 0;
-}
-
diff --git a/appl/ftp/ftpd/ftpd.cat8 b/appl/ftp/ftpd/ftpd.cat8
deleted file mode 100644
index 46530989b354..000000000000
--- a/appl/ftp/ftpd/ftpd.cat8
+++ /dev/null
@@ -1,309 +0,0 @@
-
-FTPD(8) BSD System Manager's Manual FTPD(8)
-
-NNAAMMEE
- ffttppdd -- Internet File Transfer Protocol server
-
-SSYYNNOOPPSSIISS
- ffttppdd [--aa _a_u_t_h_m_o_d_e] [--ddiillvvUU] [--gg _u_m_a_s_k] [--pp _p_o_r_t] [--TT _m_a_x_t_i_m_e_o_u_t]
- [--tt _t_i_m_e_o_u_t] [----ggssss--bbiinnddiinnggss] [--II | ----nnoo--iinnsseeccuurree--oooobb]
- [--uu _d_e_f_a_u_l_t _u_m_a_s_k] [--BB | ----bbuuiillttiinn--llss] [----ggoooodd--cchhaarrss==_s_t_r_i_n_g]
-
-DDEESSCCRRIIPPTTIIOONN
- FFttppdd is the Internet File Transfer Protocol server process. The server
- uses the TCP protocol and listens at the port specified in the ``ftp''
- service specification; see services(5).
-
- Available options:
-
- --aa Select the level of authentication required. Kerberised login
- can not be turned off. The default is to only allow kerberised
- login. Other possibilities can be turned on by giving a string
- of comma separated flags as argument to --aa. Recognised flags
- are:
-
- _p_l_a_i_n Allow logging in with plaintext password. The password can
- be a(n) OTP or an ordinary password.
-
- _o_t_p Same as _p_l_a_i_n, but only OTP is allowed.
-
- _f_t_p Allow anonymous login.
-
- The following combination modes exists for backwards compatibil-
- ity:
-
- _n_o_n_e Same as _p_l_a_i_n_,_f_t_p.
-
- _s_a_f_e Same as _f_t_p.
-
- _u_s_e_r Ignored.
-
- --dd Debugging information is written to the syslog using LOG_FTP.
-
- --gg Anonymous users will get a umask of _u_m_a_s_k.
-
- ----ggssss--bbiinnddiinnggss
- require the peer to use GSS-API bindings (ie make sure IP
- addresses match).
-
- --ii Open a socket and wait for a connection. This is mainly used for
- debugging when ftpd isn't started by inetd.
-
- --ll Each successful and failed ftp(1) session is logged using syslog
- with a facility of LOG_FTP. If this option is specified twice,
- the retrieve (get), store (put), append, delete, make directory,
- remove directory and rename operations and their filename argu-
- ments are also logged.
-
- --pp Use _p_o_r_t (a service name or number) instead of the default
- _f_t_p_/_t_c_p.
-
- --TT A client may also request a different timeout period; the maximum
- period allowed may be set to _t_i_m_e_o_u_t seconds with the --TT option.
- The default limit is 2 hours.
-
- --tt The inactivity timeout period is set to _t_i_m_e_o_u_t seconds (the
- default is 15 minutes).
-
- --uu Set the initial umask to something else than the default 027.
-
- --UU In previous versions of ffttppdd, when a passive mode client
- requested a data connection to the server, the server would use
- data ports in the range 1024..4999. Now, by default, if the sys-
- tem supports the IP_PORTRANGE socket option, the server will use
- data ports in the range 49152..65535. Specifying this option
- will revert to the old behavior.
-
- --vv Verbose mode.
-
- --BB, ----bbuuiillttiinn--llss
- use built-in ls to list files
-
- ----ggoooodd--cchhaarrss==_s_t_r_i_n_g
- allowed anonymous upload filename chars
-
- --II ----nnoo--iinnsseeccuurree--oooobb
- don't allow insecure out of band. Heimdal ftp clients before
- 0.6.3 doesn't support secure oob, so turning on this option makes
- them no longer work.
-
- The file _/_e_t_c_/_n_o_l_o_g_i_n can be used to disable ftp access. If the file
- exists, ffttppdd displays it and exits. If the file _/_e_t_c_/_f_t_p_w_e_l_c_o_m_e exists,
- ffttppdd prints it before issuing the ``ready'' message. If the file
- _/_e_t_c_/_m_o_t_d exists, ffttppdd prints it after a successful login.
-
- The ftp server currently supports the following ftp requests. The case
- of the requests is ignored.
-
- Request Description
- ABOR abort previous command
- ACCT specify account (ignored)
- ALLO allocate storage (vacuously)
- APPE append to a file
- CDUP change to parent of current working directory
- CWD change working directory
- DELE delete a file
- HELP give help information
- LIST give list files in a directory (``ls -lgA'')
- MKD make a directory
- MDTM show last modification time of file
- MODE specify data transfer _m_o_d_e
- NLST give name list of files in directory
- NOOP do nothing
- PASS specify password
- PASV prepare for server-to-server transfer
- PORT specify data connection port
- PWD print the current working directory
- QUIT terminate session
- REST restart incomplete transfer
- RETR retrieve a file
- RMD remove a directory
- RNFR specify rename-from file name
- RNTO specify rename-to file name
- SITE non-standard commands (see next section)
- SIZE return size of file
- STAT return status of server
- STOR store a file
- STOU store a file with a unique name
- STRU specify data transfer _s_t_r_u_c_t_u_r_e
- SYST show operating system type of server system
- TYPE specify data transfer _t_y_p_e
- USER specify user name
- XCUP change to parent of current working directory
- (deprecated)
- XCWD change working directory (deprecated)
- XMKD make a directory (deprecated)
- XPWD print the current working directory (deprecated)
- XRMD remove a directory (deprecated)
-
- The following commands are specified by RFC2228.
-
- AUTH authentication/security mechanism
- ADAT authentication/security data
- PROT data channel protection level
- PBSZ protection buffer size
- MIC integrity protected command
- CONF confidentiality protected command
- ENC privacy protected command
- CCC clear command channel
-
- The following non-standard or UNIX specific commands are supported by the
- SITE request.
-
- UMASK change umask, (e.g. SSIITTEE UUMMAASSKK 000022)
- IDLE set idle-timer, (e.g. SSIITTEE IIDDLLEE 6600)
- CHMOD change mode of a file (e.g. SSIITTEE CCHHMMOODD 775555 ffiilleennaammee)
- FIND quickly find a specific file with GNU locate(1).
- HELP give help information.
-
- The following Kerberos related site commands are understood.
-
- KAUTH obtain remote tickets.
- KLIST show remote tickets
-
- The remaining ftp requests specified in Internet RFC 959 are recognized,
- but not implemented. MDTM and SIZE are not specified in RFC 959, but
- will appear in the next updated FTP RFC.
-
- The ftp server will abort an active file transfer only when the ABOR com-
- mand is preceded by a Telnet "Interrupt Process" (IP) signal and a Telnet
- "Synch" signal in the command Telnet stream, as described in Internet RFC
- 959. If a STAT command is received during a data transfer, preceded by a
- Telnet IP and Synch, transfer status will be returned.
-
- FFttppdd interprets file names according to the ``globbing'' conventions used
- by csh(1). This allows users to use the metacharacters ``*?[]{}~''.
-
- FFttppdd authenticates users according to these rules.
-
- 1. If Kerberos authentication is used, the user must pass valid
- tickets and the principal must be allowed to login as the
- remote user.
-
- 2. The login name must be in the password data base, and not have
- a null password (if Kerberos is used the password field is not
- checked). In this case a password must be provided by the
- client before any file operations may be performed. If the
- user has an OTP key, the response from a successful USER com-
- mand will include an OTP challenge. The client may choose to
- respond with a PASS command giving either a standard password
- or an OTP one-time password. The server will automatically
- determine which type of password it has been given and attempt
- to authenticate accordingly. See otp(1) for more information
- on OTP authentication.
-
- 3. The login name must not appear in the file _/_e_t_c_/_f_t_p_u_s_e_r_s.
-
- 4. The user must have a standard shell returned by
- getusershell(3).
-
- 5. If the user name appears in the file _/_e_t_c_/_f_t_p_c_h_r_o_o_t the ses-
- sion's root will be changed to the user's login directory by
- chroot(2) as for an ``anonymous'' or ``ftp'' account (see next
- item). However, the user must still supply a password. This
- feature is intended as a compromise between a fully anonymous
- account and a fully privileged account. The account should
- also be set up as for an anonymous account.
-
- 6. If the user name is ``anonymous'' or ``ftp'', an anonymous ftp
- account must be present in the password file (user ``ftp'').
- In this case the user is allowed to log in by specifying any
- password (by convention an email address for the user should
- be used as the password).
-
- In the last case, ffttppdd takes special measures to restrict the client's
- access privileges. The server performs a chroot(2) to the home directory
- of the ``ftp'' user. In order that system security is not breached, it
- is recommended that the ``ftp'' subtree be constructed with care, con-
- sider following these guidelines for anonymous ftp.
-
- In general all files should be owned by ``root'', and have non-write per-
- missions (644 or 755 depending on the kind of file). No files should be
- owned or writable by ``ftp'' (possibly with exception for the
- _~_f_t_p_/_i_n_c_o_m_i_n_g, as specified below).
-
- _~_f_t_p The ``ftp'' homedirectory should be owned by root.
-
- _~_f_t_p_/_b_i_n The directory for external programs (such as ls(1)).
- These programs must either be statically linked, or you
- must setup an environment for dynamic linking when run-
- ning chrooted. These programs will be used if present:
-
- ls Used when listing files.
-
- compress
- When retrieving a filename that ends in _._Z,
- and that file isn't present, ffttppdd will try
- to find the filename without _._Z and com-
- press it on the fly.
-
- gzip Same as compress, just with files ending in
- _._g_z.
-
- gtar Enables retrieval of whole directories as
- files ending in _._t_a_r. Can also be combined
- with compression. You must use GNU Tar (or
- some other that supports the --zz and --ZZ
- flags).
-
- locate Will enable ``fast find'' with the SSIITTEE
- FFIINNDD command. You must also create a
- _l_o_c_a_t_e_d_b file in _~_f_t_p_/_e_t_c.
-
- _~_f_t_p_/_e_t_c If you put copies of the passwd(5) and group(5) files
- here, ls will be able to produce owner names rather than
- numbers. Remember to remove any passwords from these
- files.
-
- The file _m_o_t_d, if present, will be printed after a suc-
- cessful login.
-
- _~_f_t_p_/_d_e_v Put a copy of /dev/null(7) here.
-
- _~_f_t_p_/_p_u_b Traditional place to put whatever you want to make pub-
- lic.
-
- If you want guests to be able to upload files, create a _~_f_t_p_/_i_n_c_o_m_i_n_g
- directory owned by ``root'', and group ``ftp'' with mode 730 (make sure
- ``ftp'' is member of group ``ftp''). The following restrictions apply to
- anonymous users:
-
- ++oo Directories created will have mode 700.
-
- ++oo Uploaded files will be created with an umask of 777, if not changed
- with the --gg option.
-
- ++oo These command are not accessible: DDEELLEE, RRMMDD, RRNNTTOO, RRNNFFRR, SSIITTEE UUMMAASSKK,
- and SSIITTEE CCHHMMOODD.
-
- ++oo Filenames must start with an alpha-numeric character, and consist of
- alpha-numeric characters or any of the following: + (plus), -
- (minus), = (equal), _ (underscore), . (period), and , (comma).
-
-FFIILLEESS
- /etc/ftpusers Access list for users.
- /etc/ftpchroot List of normal users who should be chroot'd.
- /etc/ftpwelcome Welcome notice.
- /etc/motd Welcome notice after login.
- /etc/nologin Displayed and access refused.
- ~/.klogin Login access for Kerberos.
-
-SSEEEE AALLSSOO
- ftp(1), otp(1), getusershell(3), ftpusers(5), syslogd(8)
-
-SSTTAANNDDAARRDDSS
- RRFFCC 995599 FTP PROTOCOL SPECIFICATION
- RRFFCC 11993388 OTP Specification
- RRFFCC 22222288 FTP Security Extensions.
-
-BBUUGGSS
- The server must run as the super-user to create sockets with privileged
- port numbers. It maintains an effective user id of the logged in user,
- reverting to the super-user only when binding addresses to sockets. The
- possible security holes have been extensively scrutinized, but are possi-
- bly incomplete.
-
-HHIISSTTOORRYY
- The ffttppdd command appeared in 4.2BSD.
-
-4.2 Berkeley Distribution July 19, 2003 4.2 Berkeley Distribution
diff --git a/appl/ftp/ftpd/ftpd_locl.h b/appl/ftp/ftpd/ftpd_locl.h
deleted file mode 100644
index cff3ff3d46a5..000000000000
--- a/appl/ftp/ftpd/ftpd_locl.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright (c) 1998 - 2000 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the Institute nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/* $Id$ */
-
-#ifndef __ftpd_locl_h__
-#define __ftpd_locl_h__
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-/*
- * FTP server.
- */
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#if defined(HAVE_SYS_IOCTL_H) && SunOS != 40
-#include <sys/ioctl.h>
-#endif
-#ifdef HAVE_SYS_IOCCOM_H
-#include <sys/ioccom.h>
-#endif
-#ifdef TIME_WITH_SYS_TIME
-#include <sys/time.h>
-#include <time.h>
-#elif defined(HAVE_SYS_TIME_H)
-#include <sys/time.h>
-#else
-#include <time.h>
-#endif
-#ifdef HAVE_SYS_RESOURCE_H
-#include <sys/resource.h>
-#endif
-#ifdef HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
-
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-#ifdef HAVE_NETINET_IN_SYSTM_H
-#include <netinet/in_systm.h>
-#endif
-#ifdef HAVE_NETINET_IP_H
-#include <netinet/ip.h>
-#endif
-
-#ifdef HAVE_SYS_MMAN_H
-#include <sys/mman.h>
-#endif
-
-#include <arpa/ftp.h>
-#ifdef HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-#ifdef HAVE_ARPA_TELNET_H
-#include <arpa/telnet.h>
-#endif
-
-#include <ctype.h>
-#ifdef HAVE_DIRENT_H
-#include <dirent.h>
-#endif
-#include <errno.h>
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-#include <glob.h>
-#include <limits.h>
-#ifdef HAVE_PWD_H
-#include <pwd.h>
-#endif
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#ifdef HAVE_SYSLOG_H
-#include <syslog.h>
-#endif
-#include <time.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_GRP_H
-#include <grp.h>
-#endif
-#include <fnmatch.h>
-
-#ifdef HAVE_BSD_BSD_H
-#include <bsd/bsd.h>
-#endif
-
-#include <err.h>
-#include "roken.h"
-
-#include "pathnames.h"
-#include "extern.h"
-#include "common.h"
-
-#include "security.h"
-
-#ifdef KRB5
-#include <krb5.h>
-#endif /* KRB5 */
-
-#if defined(KRB5)
-#include <kafs.h>
-#endif
-
-#ifdef OTP
-#include <otp.h>
-#endif
-
-#ifdef SOCKS
-#include <socks.h>
-extern int LIBPREFIX(fclose) (FILE *);
-#endif
-
-/* SunOS doesn't have any declaration of fclose */
-
-int fclose(FILE *stream);
-
-int yyparse(void);
-
-#ifndef LOG_FTP
-#define LOG_FTP LOG_DAEMON
-#endif
-
-#endif /* __ftpd_locl_h__ */
diff --git a/appl/ftp/ftpd/ftpusers.5 b/appl/ftp/ftpd/ftpusers.5
deleted file mode 100644
index 2e00a2b26ae3..000000000000
--- a/appl/ftp/ftpd/ftpusers.5
+++ /dev/null
@@ -1,37 +0,0 @@
-.\" $Id$
-.\"
-.Dd May 7, 1997
-.Dt FTPUSERS 5
-.Os KTH-KRB
-.Sh NAME
-.Pa /etc/ftpusers
-.Nd FTP access list file
-.Sh DESCRIPTION
-.Pa /etc/ftpusers
-contains a list of users that should be allowed or denied FTP
-access. Each line contains a user, optionally followed by
-.Dq allow
-(anything but
-.Dq allow
-is ignored). The semi-user
-.Dq *
-matches any user. Users that has an explicit
-.Dq allow ,
-or that does not match any line, are allowed access. Anyone else is
-denied access.
-.Pp
-Note that this is compatible with the old format, where this file
-contained a list of users that should be denied access.
-.Sh EXAMPLES
-This will deny anyone but
-.Dq foo
-and
-.Dq bar
-to use FTP:
-.Bd -literal
-foo allow
-bar allow
-*
-.Ed
-.Sh SEE ALSO
-.Xr ftpd 8
diff --git a/appl/ftp/ftpd/ftpusers.cat5 b/appl/ftp/ftpd/ftpusers.cat5
deleted file mode 100644
index 533b2b0015d9..000000000000
--- a/appl/ftp/ftpd/ftpusers.cat5
+++ /dev/null
@@ -1,27 +0,0 @@
-
-FTPUSERS(5) BSD File Formats Manual FTPUSERS(5)
-
-NNAAMMEE
- _/_e_t_c_/_f_t_p_u_s_e_r_s -- FTP access list file
-
-DDEESSCCRRIIPPTTIIOONN
- _/_e_t_c_/_f_t_p_u_s_e_r_s contains a list of users that should be allowed or denied
- FTP access. Each line contains a user, optionally followed by ``allow''
- (anything but ``allow'' is ignored). The semi-user ``*'' matches any
- user. Users that has an explicit ``allow'', or that does not match any
- line, are allowed access. Anyone else is denied access.
-
- Note that this is compatible with the old format, where this file con-
- tained a list of users that should be denied access.
-
-EEXXAAMMPPLLEESS
- This will deny anyone but ``foo'' and ``bar'' to use FTP:
-
- foo allow
- bar allow
- *
-
-SSEEEE AALLSSOO
- ftpd(8)
-
-KTH-KRB May 7, 1997 KTH-KRB
diff --git a/appl/ftp/ftpd/gss_userok.c b/appl/ftp/ftpd/gss_userok.c
deleted file mode 100644
index 6031b52a87e9..000000000000
--- a/appl/ftp/ftpd/gss_userok.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 1998 - 2001 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the Institute nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "ftpd_locl.h"
-#include <gssapi/gssapi.h>
-
-/* XXX sync with gssapi.c */
-struct gssapi_data {
- gss_ctx_id_t context_hdl;
- gss_name_t client_name;
- gss_cred_id_t delegated_cred_handle;
- void *mech_data;
-};
-
-int gssapi_userok(void*, char*); /* to keep gcc happy */
-int gssapi_session(void*, char*); /* to keep gcc happy */
-
-int
-gssapi_userok(void *app_data, char *username)
-{
- struct gssapi_data *data = app_data;
-
- /* Yes, this logic really is inverted. */
- return !gss_userok(data->client_name, username);
-}
-
-int
-gssapi_session(void *app_data, char *username)
-{
- struct gssapi_data *data = app_data;
- OM_uint32 major, minor;
- int ret = 0;
-
- if (data->delegated_cred_handle != GSS_C_NO_CREDENTIAL) {
- major = gss_store_cred(&minor, data->delegated_cred_handle,
- GSS_C_INITIATE, GSS_C_NO_OID,
- 1, 1, NULL, NULL);
- if (GSS_ERROR(major))
- ret = 1;
- afslog(NULL, 1);
- }
-
- gss_release_cred(&minor, &data->delegated_cred_handle);
- return ret;
-}
diff --git a/appl/ftp/ftpd/gssapi.c b/appl/ftp/ftpd/gssapi.c
deleted file mode 100644
index 29be7641c965..000000000000
--- a/appl/ftp/ftpd/gssapi.c
+++ /dev/null
@@ -1,511 +0,0 @@
-/*
- * Copyright (c) 1998 - 2005 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the Institute nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifdef FTP_SERVER
-#include "ftpd_locl.h"
-#else
-#include "ftp_locl.h"
-#endif
-#include <gssapi/gssapi.h>
-#include <gssapi/gssapi_krb5.h>
-#include <krb5_err.h>
-
-RCSID("$Id$");
-
-int ftp_do_gss_bindings = 0;
-int ftp_do_gss_delegate = 1;
-
-struct gssapi_data {
- gss_ctx_id_t context_hdl;
- gss_name_t client_name;
- gss_cred_id_t delegated_cred_handle;
- void *mech_data;
-};
-
-static int
-gss_init(void *app_data)
-{
- struct gssapi_data *d = app_data;
- d->context_hdl = GSS_C_NO_CONTEXT;
- d->delegated_cred_handle = GSS_C_NO_CREDENTIAL;
-#if defined(FTP_SERVER)
- return 0;
-#else
- /* XXX Check the gss mechanism; with gss_indicate_mechs() ? */
-#ifdef KRB5
- return !use_kerberos;
-#else
- return 0;
-#endif /* KRB5 */
-#endif /* FTP_SERVER */
-}
-
-static int
-gss_check_prot(void *app_data, int level)
-{
- if(level == prot_confidential)
- return -1;
- return 0;
-}
-
-static int
-gss_decode(void *app_data, void *buf, int len, int level)
-{
- OM_uint32 maj_stat, min_stat;
- gss_buffer_desc input, output;
- gss_qop_t qop_state;
- int conf_state;
- struct gssapi_data *d = app_data;
- size_t ret_len;
-
- input.length = len;
- input.value = buf;
- maj_stat = gss_unwrap (&min_stat,
- d->context_hdl,
- &input,
- &output,
- &conf_state,
- &qop_state);
- if(GSS_ERROR(maj_stat))
- return -1;
- memmove(buf, output.value, output.length);
- ret_len = output.length;
- gss_release_buffer(&min_stat, &output);
- return ret_len;
-}
-
-static int
-gss_overhead(void *app_data, int level, int len)
-{
- return 100; /* dunno? */
-}
-
-
-static int
-gss_encode(void *app_data, void *from, int length, int level, void **to)
-{
- OM_uint32 maj_stat, min_stat;
- gss_buffer_desc input, output;
- int conf_state;
- struct gssapi_data *d = app_data;
-
- input.length = length;
- input.value = from;
- maj_stat = gss_wrap (&min_stat,
- d->context_hdl,
- level == prot_private,
- GSS_C_QOP_DEFAULT,
- &input,
- &conf_state,
- &output);
- *to = output.value;
- return output.length;
-}
-
-static void
-sockaddr_to_gss_address (struct sockaddr *sa,
- OM_uint32 *addr_type,
- gss_buffer_desc *gss_addr)
-{
- switch (sa->sa_family) {
-#ifdef HAVE_IPV6
- case AF_INET6 : {
- struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sa;
-
- gss_addr->length = 16;
- gss_addr->value = &sin6->sin6_addr;
- *addr_type = GSS_C_AF_INET6;
- break;
- }
-#endif
- case AF_INET : {
- struct sockaddr_in *sin4 = (struct sockaddr_in *)sa;
-
- gss_addr->length = 4;
- gss_addr->value = &sin4->sin_addr;
- *addr_type = GSS_C_AF_INET;
- break;
- }
- default :
- errx (1, "unknown address family %d", sa->sa_family);
-
- }
-}
-
-/* end common stuff */
-
-#ifdef FTP_SERVER
-
-static int
-gss_adat(void *app_data, void *buf, size_t len)
-{
- char *p = NULL;
- gss_buffer_desc input_token, output_token;
- OM_uint32 maj_stat, min_stat;
- gss_name_t client_name;
- struct gssapi_data *d = app_data;
- gss_channel_bindings_t bindings;
-
- if (ftp_do_gss_bindings) {
- bindings = malloc(sizeof(*bindings));
- if (bindings == NULL)
- errx(1, "out of memory");
-
- sockaddr_to_gss_address (his_addr,
- &bindings->initiator_addrtype,
- &bindings->initiator_address);
- sockaddr_to_gss_address (ctrl_addr,
- &bindings->acceptor_addrtype,
- &bindings->acceptor_address);
-
- bindings->application_data.length = 0;
- bindings->application_data.value = NULL;
- } else
- bindings = GSS_C_NO_CHANNEL_BINDINGS;
-
- input_token.value = buf;
- input_token.length = len;
-
- maj_stat = gss_accept_sec_context (&min_stat,
- &d->context_hdl,
- GSS_C_NO_CREDENTIAL,
- &input_token,
- bindings,
- &client_name,
- NULL,
- &output_token,
- NULL,
- NULL,
- &d->delegated_cred_handle);
-
- if (bindings != GSS_C_NO_CHANNEL_BINDINGS)
- free(bindings);
-
- if(output_token.length) {
- if(base64_encode(output_token.value, output_token.length, &p) < 0) {
- reply(535, "Out of memory base64-encoding.");
- return -1;
- }
- gss_release_buffer(&min_stat, &output_token);
- }
- if(maj_stat == GSS_S_COMPLETE){
- d->client_name = client_name;
- client_name = GSS_C_NO_NAME;
- if(p)
- reply(235, "ADAT=%s", p);
- else
- reply(235, "ADAT Complete");
- sec_complete = 1;
-
- } else if(maj_stat == GSS_S_CONTINUE_NEEDED) {
- if(p)
- reply(335, "ADAT=%s", p);
- else
- reply(335, "OK, need more data");
- } else {
- OM_uint32 new_stat;
- OM_uint32 msg_ctx = 0;
- gss_buffer_desc status_string;
- gss_display_status(&new_stat,
- min_stat,
- GSS_C_MECH_CODE,
- GSS_C_NO_OID,
- &msg_ctx,
- &status_string);
- syslog(LOG_ERR, "gss_accept_sec_context: %.*s",
- (int)status_string.length,
- (char*)status_string.value);
- gss_release_buffer(&new_stat, &status_string);
- reply(431, "Security resource unavailable");
- }
-
- if (client_name)
- gss_release_name(&min_stat, &client_name);
- free(p);
- return 0;
-}
-
-int gssapi_userok(void*, char*);
-int gssapi_session(void*, char*);
-
-struct sec_server_mech gss_server_mech = {
- "GSSAPI",
- sizeof(struct gssapi_data),
- gss_init, /* init */
- NULL, /* end */
- gss_check_prot,
- gss_overhead,
- gss_encode,
- gss_decode,
- /* */
- NULL,
- gss_adat,
- NULL, /* pbsz */
- NULL, /* ccc */
- gssapi_userok,
- gssapi_session
-};
-
-#else /* FTP_SERVER */
-
-extern struct sockaddr *hisctladdr, *myctladdr;
-
-static int
-import_name(const char *kname, const char *host, gss_name_t *target_name)
-{
- OM_uint32 maj_stat, min_stat;
- gss_buffer_desc name;
- char *str;
-
- name.length = asprintf(&str, "%s@%s", kname, host);
- if (str == NULL) {
- printf("Out of memory\n");
- return AUTH_ERROR;
- }
- name.value = str;
-
- maj_stat = gss_import_name(&min_stat,
- &name,
- GSS_C_NT_HOSTBASED_SERVICE,
- target_name);
- if (GSS_ERROR(maj_stat)) {
- OM_uint32 new_stat;
- OM_uint32 msg_ctx = 0;
- gss_buffer_desc status_string;
-
- gss_display_status(&new_stat,
- min_stat,
- GSS_C_MECH_CODE,
- GSS_C_NO_OID,
- &msg_ctx,
- &status_string);
- printf("Error importing name %.*s: %.*s\n",
- (int)name.length,
- (char *)name.value,
- (int)status_string.length,
- (char *)status_string.value);
- free(name.value);
- gss_release_buffer(&new_stat, &status_string);
- return AUTH_ERROR;
- }
- free(name.value);
- return 0;
-}
-
-static int
-gss_auth(void *app_data, char *host)
-{
-
- OM_uint32 maj_stat, min_stat;
- gss_name_t target_name;
- gss_buffer_desc input, output_token;
- int context_established = 0;
- char *p;
- int n;
- gss_channel_bindings_t bindings;
- struct gssapi_data *d = app_data;
- OM_uint32 mech_flags = GSS_C_MUTUAL_FLAG | GSS_C_SEQUENCE_FLAG;
-
- const char *knames[] = { "ftp", "host", NULL }, **kname = knames;
-
-
- if(import_name(*kname++, host, &target_name))
- return AUTH_ERROR;
-
- input.length = 0;
- input.value = NULL;
-
- if (ftp_do_gss_bindings) {
- bindings = malloc(sizeof(*bindings));
- if (bindings == NULL)
- errx(1, "out of memory");
-
- sockaddr_to_gss_address (myctladdr,
- &bindings->initiator_addrtype,
- &bindings->initiator_address);
- sockaddr_to_gss_address (hisctladdr,
- &bindings->acceptor_addrtype,
- &bindings->acceptor_address);
-
- bindings->application_data.length = 0;
- bindings->application_data.value = NULL;
- } else
- bindings = GSS_C_NO_CHANNEL_BINDINGS;
-
- if (ftp_do_gss_delegate)
- mech_flags |= GSS_C_DELEG_FLAG;
-
- while(!context_established) {
- maj_stat = gss_init_sec_context(&min_stat,
- GSS_C_NO_CREDENTIAL,
- &d->context_hdl,
- target_name,
- GSS_C_NO_OID,
- mech_flags,
- 0,
- bindings,
- &input,
- NULL,
- &output_token,
- NULL,
- NULL);
- if (GSS_ERROR(maj_stat)) {
- OM_uint32 new_stat;
- OM_uint32 msg_ctx = 0;
- gss_buffer_desc status_string;
-
- d->context_hdl = GSS_C_NO_CONTEXT;
-
- gss_release_name(&min_stat, &target_name);
-
- if(*kname != NULL) {
-
- if(import_name(*kname++, host, &target_name)) {
- if (bindings != GSS_C_NO_CHANNEL_BINDINGS)
- free(bindings);
- return AUTH_ERROR;
- }
- continue;
- }
-
- if (bindings != GSS_C_NO_CHANNEL_BINDINGS)
- free(bindings);
-
- gss_display_status(&new_stat,
- min_stat,
- GSS_C_MECH_CODE,
- GSS_C_NO_OID,
- &msg_ctx,
- &status_string);
- printf("Error initializing security context: %.*s\n",
- (int)status_string.length,
- (char*)status_string.value);
- gss_release_buffer(&new_stat, &status_string);
- return AUTH_CONTINUE;
- }
-
- if (input.value) {
- free(input.value);
- input.value = NULL;
- input.length = 0;
- }
- if (output_token.length != 0) {
- base64_encode(output_token.value, output_token.length, &p);
- gss_release_buffer(&min_stat, &output_token);
- n = command("ADAT %s", p);
- free(p);
- }
- if (GSS_ERROR(maj_stat)) {
- if (d->context_hdl != GSS_C_NO_CONTEXT)
- gss_delete_sec_context (&min_stat,
- &d->context_hdl,
- GSS_C_NO_BUFFER);
- break;
- }
- if (maj_stat & GSS_S_CONTINUE_NEEDED) {
- p = strstr(reply_string, "ADAT=");
- if(p == NULL){
- printf("Error: expected ADAT in reply. got: %s\n",
- reply_string);
- if (bindings != GSS_C_NO_CHANNEL_BINDINGS)
- free(bindings);
- return AUTH_ERROR;
- } else {
- p+=5;
- input.value = malloc(strlen(p));
- input.length = base64_decode(p, input.value);
- }
- } else {
- if(code != 235) {
- printf("Unrecognized response code: %d\n", code);
- if (bindings != GSS_C_NO_CHANNEL_BINDINGS)
- free(bindings);
- return AUTH_ERROR;
- }
- context_established = 1;
- }
- }
-
- gss_release_name(&min_stat, &target_name);
-
- if (bindings != GSS_C_NO_CHANNEL_BINDINGS)
- free(bindings);
- if (input.value)
- free(input.value);
-
- {
- gss_name_t targ_name;
-
- maj_stat = gss_inquire_context(&min_stat,
- d->context_hdl,
- NULL,
- &targ_name,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL);
- if (GSS_ERROR(maj_stat) == 0) {
- gss_buffer_desc name;
- maj_stat = gss_display_name (&min_stat,
- targ_name,
- &name,
- NULL);
- if (GSS_ERROR(maj_stat) == 0) {
- printf("Authenticated to <%.*s>\n",
- (int)name.length,
- (char *)name.value);
- gss_release_buffer(&min_stat, &name);
- }
- gss_release_name(&min_stat, &targ_name);
- } else
- printf("Failed to get gss name of peer.\n");
- }
-
-
- return AUTH_OK;
-}
-
-struct sec_client_mech gss_client_mech = {
- "GSSAPI",
- sizeof(struct gssapi_data),
- gss_init,
- gss_auth,
- NULL, /* end */
- gss_check_prot,
- gss_overhead,
- gss_encode,
- gss_decode,
-};
-
-#endif /* FTP_SERVER */
diff --git a/appl/ftp/ftpd/kauth.c b/appl/ftp/ftpd/kauth.c
deleted file mode 100644
index 546461d9dbc2..000000000000
--- a/appl/ftp/ftpd/kauth.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright (c) 1995 - 1999, 2003 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the Institute nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "ftpd_locl.h"
-
-RCSID("$Id$");
-
-#if defined(KRB5)
-
-int do_destroy_tickets = 1;
-char *k5ccname;
-
-#endif
-
-#ifdef KRB5
-
-static void
-dest_cc(void)
-{
- krb5_context context;
- krb5_error_code ret;
- krb5_ccache id;
-
- ret = krb5_init_context(&context);
- if (ret == 0) {
- if (k5ccname)
- ret = krb5_cc_resolve(context, k5ccname, &id);
- else
- ret = krb5_cc_default (context, &id);
- if (ret)
- krb5_free_context(context);
- }
- if (ret == 0) {
- krb5_cc_destroy(context, id);
- krb5_free_context (context);
- }
-}
-#endif
-
-#if defined(KRB5)
-
-/*
- * Only destroy if we created the tickets
- */
-
-void
-cond_kdestroy(void)
-{
- if (do_destroy_tickets) {
-#if KRB5
- dest_cc();
-#endif
- do_destroy_tickets = 0;
- }
- afsunlog();
-}
-
-void
-kdestroy(void)
-{
-#if KRB5
- dest_cc();
-#endif
- afsunlog();
- reply(200, "Tickets destroyed");
-}
-
-
-void
-afslog(const char *cell, int quiet)
-{
- if(k_hasafs()) {
-#ifdef KRB5
- krb5_context context;
- krb5_error_code ret;
- krb5_ccache id;
-
- ret = krb5_init_context(&context);
- if (ret == 0) {
- if (k5ccname)
- ret = krb5_cc_resolve(context, k5ccname, &id);
- else
- ret = krb5_cc_default(context, &id);
- if (ret)
- krb5_free_context(context);
- }
- if (ret == 0) {
- krb5_afslog(context, id, cell, 0);
- krb5_cc_close (context, id);
- krb5_free_context (context);
- }
-#endif
- if (!quiet)
- reply(200, "afslog done");
- } else {
- if (!quiet)
- reply(200, "no AFS present");
- }
-}
-
-void
-afsunlog(void)
-{
- if(k_hasafs())
- k_unlog();
-}
-
-#else
-int ftpd_afslog_placeholder;
-#endif /* KRB5 */
diff --git a/appl/ftp/ftpd/klist.c b/appl/ftp/ftpd/klist.c
deleted file mode 100644
index 5da107d29b0f..000000000000
--- a/appl/ftp/ftpd/klist.c
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * Copyright (c) 1995 - 2005 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the Institute nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "ftpd_locl.h"
-
-#ifdef KRB5
-
-static int
-print_cred(krb5_context context, krb5_creds *cred)
-{
- char t1[128], t2[128], *str;
- krb5_error_code ret;
- krb5_timestamp sec;
-
- krb5_timeofday (context, &sec);
-
- if(cred->times.starttime)
- krb5_format_time(context, cred->times.starttime, t1, sizeof(t1), 1);
- else
- krb5_format_time(context, cred->times.authtime, t1, sizeof(t1), 1);
-
- if(cred->times.endtime > sec)
- krb5_format_time(context, cred->times.endtime, t2, sizeof(t2), 1);
- else
- strlcpy(t2, ">>>Expired<<<", sizeof(t2));
-
- ret = krb5_unparse_name (context, cred->server, &str);
- if (ret) {
- lreply(500, "krb5_unparse_name: %d", ret);
- return 1;
- }
-
- lreply(200, "%-20s %-20s %s", t1, t2, str);
- free(str);
- return 0;
-}
-
-static int
-print_tickets (krb5_context context,
- krb5_ccache ccache,
- krb5_principal principal)
-{
- krb5_error_code ret;
- krb5_cc_cursor cursor;
- krb5_creds cred;
- char *str;
-
- ret = krb5_unparse_name (context, principal, &str);
- if (ret) {
- lreply(500, "krb5_unparse_name: %d", ret);
- return 500;
- }
-
- lreply(200, "%17s: %s:%s",
- "Credentials cache",
- krb5_cc_get_type(context, ccache),
- krb5_cc_get_name(context, ccache));
- lreply(200, "%17s: %s", "Principal", str);
- free (str);
-
- ret = krb5_cc_start_seq_get (context, ccache, &cursor);
- if (ret) {
- lreply(500, "krb5_cc_start_seq_get: %d", ret);
- return 500;
- }
-
- lreply(200, " Issued Expires Principal");
-
- while ((ret = krb5_cc_next_cred (context,
- ccache,
- &cursor,
- &cred)) == 0) {
- if (print_cred(context, &cred))
- return 500;
- krb5_free_cred_contents (context, &cred);
- }
- if (ret != KRB5_CC_END) {
- lreply(500, "krb5_cc_get_next: %d", ret);
- return 500;
- }
- ret = krb5_cc_end_seq_get (context, ccache, &cursor);
- if (ret) {
- lreply(500, "krb5_cc_end_seq_get: %d", ret);
- return 500;
- }
-
- return 200;
-}
-
-static int
-klist5(void)
-{
- krb5_error_code ret;
- krb5_context context;
- krb5_ccache ccache;
- krb5_principal principal;
- int exit_status = 200;
-
- ret = krb5_init_context (&context);
- if (ret) {
- lreply(500, "krb5_init_context failed: %d", ret);
- return 500;
- }
-
- if (k5ccname)
- ret = krb5_cc_resolve(context, k5ccname, &ccache);
- else
- ret = krb5_cc_default (context, &ccache);
- if (ret) {
- lreply(500, "krb5_cc_default: %d", ret);
- return 500;
- }
-
- ret = krb5_cc_get_principal (context, ccache, &principal);
- if (ret) {
- if(ret == ENOENT)
- lreply(500, "No ticket file: %s",
- krb5_cc_get_name(context, ccache));
- else
- lreply(500, "krb5_cc_get_principal: %d", ret);
-
- return 500;
- }
- exit_status = print_tickets (context, ccache, principal);
-
- ret = krb5_cc_close (context, ccache);
- if (ret) {
- lreply(500, "krb5_cc_close: %d", ret);
- exit_status = 500;
- }
-
- krb5_free_principal (context, principal);
- krb5_free_context (context);
- return exit_status;
-}
-#endif
-
-void
-klist(void)
-{
-#if KRB5
- int res = klist5();
- reply(res, " ");
-#else
- reply(500, "Command not implemented.");
-#endif
-}
-
diff --git a/appl/ftp/ftpd/logwtmp.c b/appl/ftp/ftpd/logwtmp.c
deleted file mode 100644
index 59f45b205d73..000000000000
--- a/appl/ftp/ftpd/logwtmp.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Copyright (c) 1995 - 2000 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the Institute nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-RCSID("$Id$");
-#endif
-
-#include <stdio.h>
-#include <string.h>
-#ifdef TIME_WITH_SYS_TIME
-#include <sys/time.h>
-#include <time.h>
-#elif defined(HAVE_SYS_TIME_H)
-#include <sys/time.h>
-#else
-#include <time.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-#ifdef HAVE_UTMP_H
-#include <utmp.h>
-#endif
-#ifdef HAVE_UTMPX_H
-#include <utmpx.h>
-#endif
-#ifdef HAVE_ASL_H
-#include <asl.h>
-#endif
-#include <roken.h>
-#include "extern.h"
-
-#ifndef HAVE_UTMPX_H
-#ifndef WTMP_FILE
-#ifdef _PATH_WTMP
-#define WTMP_FILE _PATH_WTMP
-#else
-#define WTMP_FILE "/var/adm/wtmp"
-#endif
-#endif
-#endif
-
-#ifdef HAVE_ASL_H
-
-#ifndef ASL_KEY_FACILITY
-#define ASL_KEY_FACILITY "Facility"
-#endif
-
-static void
-ftpd_logwtmp_asl(char *line, char *name, char *host)
-{
- static aslmsg m = NULL;
- static int init = 0;
-
- if (!init) {
- init = 1;
- m = asl_new(ASL_TYPE_MSG);
- if (m == NULL)
- return;
- asl_set(m, ASL_KEY_FACILITY, "org.h5l.ftpd");
- }
- if (m)
- asl_log(NULL, m, ASL_LEVEL_NOTICE,
- "host %s/%s user %s%sconnected pid %d",
- host, line, name, name[0] ? " " : "dis", (int)getpid());
-}
-
-#endif
-
-#ifndef HAVE_ASL_H
-
-static void
-ftpd_logwtmp_wtmp(char *line, char *name, char *host)
-{
- static int init = 0;
- static int fd;
-#ifdef WTMPX_FILE
- static int fdx;
-#endif
-#ifdef HAVE_UTMP_H
- struct utmp ut;
-#endif
-#if defined(WTMPX_FILE) || defined(HAVE_UTMPX_H)
- struct utmpx utx;
-#endif
-
-#ifdef HAVE_UTMPX_H
- memset(&utx, 0, sizeof(struct utmpx));
-#endif
-#ifdef HAVE_UTMP_H
- memset(&ut, 0, sizeof(struct utmp));
-#ifdef HAVE_STRUCT_UTMP_UT_TYPE
- if(name[0])
- ut.ut_type = USER_PROCESS;
- else
- ut.ut_type = DEAD_PROCESS;
-#endif
- strncpy(ut.ut_line, line, sizeof(ut.ut_line));
- strncpy(ut.ut_name, name, sizeof(ut.ut_name));
-#ifdef HAVE_STRUCT_UTMP_UT_PID
- ut.ut_pid = getpid();
-#endif
-#ifdef HAVE_STRUCT_UTMP_UT_HOST
- strncpy(ut.ut_host, host, sizeof(ut.ut_host));
-#endif
- ut.ut_time = time(NULL);
-#endif
-
-#if defined(WTMPX_FILE) || defined(HAVE_UTMPX_H)
- strncpy(utx.ut_line, line, sizeof(utx.ut_line));
- strncpy(utx.ut_user, name, sizeof(utx.ut_user));
- strncpy(utx.ut_host, host, sizeof(utx.ut_host));
-#ifdef HAVE_STRUCT_UTMPX_UT_SYSLEN
- utx.ut_syslen = strlen(host) + 1;
- if (utx.ut_syslen > sizeof(utx.ut_host))
- utx.ut_syslen = sizeof(utx.ut_host);
-#endif
- {
- struct timeval tv;
-
- gettimeofday (&tv, 0);
- utx.ut_tv.tv_sec = tv.tv_sec;
- utx.ut_tv.tv_usec = tv.tv_usec;
- }
-
- if(name[0])
- utx.ut_type = USER_PROCESS;
- else
- utx.ut_type = DEAD_PROCESS;
-#endif
-
-#ifdef HAVE_UTMPX_H
- pututxline(&utx);
-#endif
-
- if(!init){
-#ifdef WTMP_FILE
- fd = open(WTMP_FILE, O_WRONLY|O_APPEND, 0);
-#endif
-#ifdef WTMPX_FILE
- fdx = open(WTMPX_FILE, O_WRONLY|O_APPEND, 0);
-#endif
- init = 1;
- }
- if(fd >= 0) {
-#ifdef WTMP_FILE
- write(fd, &ut, sizeof(struct utmp)); /* XXX */
-#endif
-#ifdef WTMPX_FILE
- write(fdx, &utx, sizeof(struct utmpx));
-#endif
- }
-}
-
-#endif /* !HAVE_ASL_H */
-
-void
-ftpd_logwtmp(char *line, char *name, char *host)
-{
-#ifdef HAVE_ASL_H
- ftpd_logwtmp_asl(line, name, host);
-#else
- ftpd_logwtmp_wtmp(line, name, host);
-#endif
-}
diff --git a/appl/ftp/ftpd/ls.c b/appl/ftp/ftpd/ls.c
deleted file mode 100644
index a8366b91e773..000000000000
--- a/appl/ftp/ftpd/ls.c
+++ /dev/null
@@ -1,891 +0,0 @@
-/*
- * Copyright (c) 1999 - 2002 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of KTH nor the names of its contributors may be
- * used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY KTH AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KTH OR ITS CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
-
-#ifndef TEST
-#include "ftpd_locl.h"
-
-RCSID("$Id$");
-
-#else
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <time.h>
-#include <dirent.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <pwd.h>
-#include <grp.h>
-#include <errno.h>
-
-#define sec_fprintf2 fprintf
-#define sec_fflush fflush
-static void list_files(FILE *out, const char **files, int n_files, int flags);
-static int parse_flags(const char *options);
-
-int
-main(int argc, char **argv)
-{
- int i = 1;
- int flags;
- if(argc > 1 && argv[1][0] == '-') {
- flags = parse_flags(argv[1]);
- i = 2;
- } else
- flags = parse_flags(NULL);
-
- list_files(stdout, (const char **)argv + i, argc - i, flags);
- return 0;
-}
-#endif
-
-struct fileinfo {
- struct stat st;
- int inode;
- int bsize;
- char mode[11];
- int n_link;
- char *user;
- char *group;
- char *size;
- char *major;
- char *minor;
- char *date;
- char *filename;
- char *link;
-};
-
-static void
-free_fileinfo(struct fileinfo *f)
-{
- free(f->user);
- free(f->group);
- free(f->size);
- free(f->major);
- free(f->minor);
- free(f->date);
- free(f->filename);
- free(f->link);
-}
-
-#define LS_DIRS (1 << 0)
-#define LS_IGNORE_DOT (1 << 1)
-#define LS_SORT_MODE (3 << 2)
-#define SORT_MODE(f) ((f) & LS_SORT_MODE)
-#define LS_SORT_NAME (1 << 2)
-#define LS_SORT_MTIME (2 << 2)
-#define LS_SORT_SIZE (3 << 2)
-#define LS_SORT_REVERSE (1 << 4)
-
-#define LS_SIZE (1 << 5)
-#define LS_INODE (1 << 6)
-#define LS_TYPE (1 << 7)
-#define LS_DISP_MODE (3 << 8)
-#define DISP_MODE(f) ((f) & LS_DISP_MODE)
-#define LS_DISP_LONG (1 << 8)
-#define LS_DISP_COLUMN (2 << 8)
-#define LS_DISP_CROSS (3 << 8)
-#define LS_SHOW_ALL (1 << 10)
-#define LS_RECURSIVE (1 << 11)
-#define LS_EXTRA_BLANK (1 << 12)
-#define LS_SHOW_DIRNAME (1 << 13)
-#define LS_DIR_FLAG (1 << 14) /* these files come via list_dir */
-
-#ifndef S_ISTXT
-#define S_ISTXT S_ISVTX
-#endif
-
-#if !defined(_S_IFMT) && defined(S_IFMT)
-#define _S_IFMT S_IFMT
-#endif
-
-#ifndef S_ISSOCK
-#define S_ISSOCK(mode) (((mode) & _S_IFMT) == S_IFSOCK)
-#endif
-
-#ifndef S_ISLNK
-#define S_ISLNK(mode) (((mode) & _S_IFMT) == S_IFLNK)
-#endif
-
-static size_t
-block_convert(size_t blocks)
-{
-#ifdef S_BLKSIZE
- return blocks * S_BLKSIZE / 1024;
-#else
- return blocks * 512 / 1024;
-#endif
-}
-
-static int
-make_fileinfo(FILE *out, const char *filename, struct fileinfo *file, int flags)
-{
- char buf[128];
- int file_type = 0;
- struct stat *st = &file->st;
-
- file->inode = st->st_ino;
- file->bsize = block_convert(st->st_blocks);
-
- if(S_ISDIR(st->st_mode)) {
- file->mode[0] = 'd';
- file_type = '/';
- }
- else if(S_ISCHR(st->st_mode))
- file->mode[0] = 'c';
- else if(S_ISBLK(st->st_mode))
- file->mode[0] = 'b';
- else if(S_ISREG(st->st_mode)) {
- file->mode[0] = '-';
- if(st->st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))
- file_type = '*';
- }
- else if(S_ISFIFO(st->st_mode)) {
- file->mode[0] = 'p';
- file_type = '|';
- }
- else if(S_ISLNK(st->st_mode)) {
- file->mode[0] = 'l';
- file_type = '@';
- }
- else if(S_ISSOCK(st->st_mode)) {
- file->mode[0] = 's';
- file_type = '=';
- }
-#ifdef S_ISWHT
- else if(S_ISWHT(st->st_mode)) {
- file->mode[0] = 'w';
- file_type = '%';
- }
-#endif
- else
- file->mode[0] = '?';
- {
- char *x[] = { "---", "--x", "-w-", "-wx",
- "r--", "r-x", "rw-", "rwx" };
- strcpy(file->mode + 1, x[(st->st_mode & S_IRWXU) >> 6]);
- strcpy(file->mode + 4, x[(st->st_mode & S_IRWXG) >> 3]);
- strcpy(file->mode + 7, x[(st->st_mode & S_IRWXO) >> 0]);
- if((st->st_mode & S_ISUID)) {
- if((st->st_mode & S_IXUSR))
- file->mode[3] = 's';
- else
- file->mode[3] = 'S';
- }
- if((st->st_mode & S_ISGID)) {
- if((st->st_mode & S_IXGRP))
- file->mode[6] = 's';
- else
- file->mode[6] = 'S';
- }
- if((st->st_mode & S_ISTXT)) {
- if((st->st_mode & S_IXOTH))
- file->mode[9] = 't';
- else
- file->mode[9] = 'T';
- }
- }
- file->n_link = st->st_nlink;
- {
- struct passwd *pwd;
- pwd = getpwuid(st->st_uid);
- if(pwd == NULL) {
- if (asprintf(&file->user, "%u", (unsigned)st->st_uid) == -1)
- file->user = NULL;
- } else
- file->user = strdup(pwd->pw_name);
- if (file->user == NULL) {
- syslog(LOG_ERR, "out of memory");
- return -1;
- }
- }
- {
- struct group *grp;
- grp = getgrgid(st->st_gid);
- if(grp == NULL) {
- if (asprintf(&file->group, "%u", (unsigned)st->st_gid) == -1)
- file->group = NULL;
- } else
- file->group = strdup(grp->gr_name);
- if (file->group == NULL) {
- syslog(LOG_ERR, "out of memory");
- return -1;
- }
- }
-
- if(S_ISCHR(st->st_mode) || S_ISBLK(st->st_mode)) {
-#if defined(major) && defined(minor)
- if (asprintf(&file->major, "%u", (unsigned)major(st->st_rdev)) == -1)
- file->major = NULL;
- if (asprintf(&file->minor, "%u", (unsigned)minor(st->st_rdev)) == -1)
- file->minor = NULL;
-#else
- /* Don't want to use the DDI/DKI crap. */
- if (asprintf(&file->major, "%u", (unsigned)st->st_rdev) == -1)
- file->major = NULL;
- if (asprintf(&file->minor, "%u", 0) == -1)
- file->minor = NULL;
-#endif
- if (file->major == NULL || file->minor == NULL) {
- syslog(LOG_ERR, "out of memory");
- return -1;
- }
- } else {
- if (asprintf(&file->size, "%lu", (unsigned long)st->st_size) == -1)
- file->size = NULL;
- }
-
- {
- time_t t = time(NULL);
- time_t mtime = st->st_mtime;
- struct tm *tm = localtime(&mtime);
- if((t - mtime > 6*30*24*60*60) ||
- (mtime - t > 6*30*24*60*60))
- strftime(buf, sizeof(buf), "%b %e %Y", tm);
- else
- strftime(buf, sizeof(buf), "%b %e %H:%M", tm);
- file->date = strdup(buf);
- if (file->date == NULL) {
- syslog(LOG_ERR, "out of memory");
- return -1;
- }
- }
- {
- const char *p = strrchr(filename, '/');
- if(p)
- p++;
- else
- p = filename;
- if((flags & LS_TYPE) && file_type != 0) {
- if (asprintf(&file->filename, "%s%c", p, file_type) == -1)
- file->filename = NULL;
- } else
- file->filename = strdup(p);
- if (file->filename == NULL) {
- syslog(LOG_ERR, "out of memory");
- return -1;
- }
- }
- if(S_ISLNK(st->st_mode)) {
- int n;
- n = readlink((char *)filename, buf, sizeof(buf) - 1);
- if(n >= 0) {
- buf[n] = '\0';
- file->link = strdup(buf);
- if (file->link == NULL) {
- syslog(LOG_ERR, "out of memory");
- return -1;
- }
- } else
- sec_fprintf2(out, "readlink(%s): %s", filename, strerror(errno));
- }
- return 0;
-}
-
-static void
-print_file(FILE *out,
- int flags,
- struct fileinfo *f,
- int max_inode,
- int max_bsize,
- int max_n_link,
- int max_user,
- int max_group,
- int max_size,
- int max_major,
- int max_minor,
- int max_date)
-{
- if(f->filename == NULL)
- return;
-
- if(flags & LS_INODE) {
- sec_fprintf2(out, "%*d", max_inode, f->inode);
- sec_fprintf2(out, " ");
- }
- if(flags & LS_SIZE) {
- sec_fprintf2(out, "%*d", max_bsize, f->bsize);
- sec_fprintf2(out, " ");
- }
- sec_fprintf2(out, "%s", f->mode);
- sec_fprintf2(out, " ");
- sec_fprintf2(out, "%*d", max_n_link, f->n_link);
- sec_fprintf2(out, " ");
- sec_fprintf2(out, "%-*s", max_user, f->user);
- sec_fprintf2(out, " ");
- sec_fprintf2(out, "%-*s", max_group, f->group);
- sec_fprintf2(out, " ");
- if(f->major != NULL && f->minor != NULL)
- sec_fprintf2(out, "%*s, %*s", max_major, f->major, max_minor, f->minor);
- else
- sec_fprintf2(out, "%*s", max_size, f->size);
- sec_fprintf2(out, " ");
- sec_fprintf2(out, "%*s", max_date, f->date);
- sec_fprintf2(out, " ");
- sec_fprintf2(out, "%s", f->filename);
- if(f->link)
- sec_fprintf2(out, " -> %s", f->link);
- sec_fprintf2(out, "\r\n");
-}
-
-static int
-compare_filename(struct fileinfo *a, struct fileinfo *b)
-{
- if(a->filename == NULL)
- return 1;
- if(b->filename == NULL)
- return -1;
- return strcmp(a->filename, b->filename);
-}
-
-static int
-compare_mtime(struct fileinfo *a, struct fileinfo *b)
-{
- if(a->filename == NULL)
- return 1;
- if(b->filename == NULL)
- return -1;
- return b->st.st_mtime - a->st.st_mtime;
-}
-
-static int
-compare_size(struct fileinfo *a, struct fileinfo *b)
-{
- if(a->filename == NULL)
- return 1;
- if(b->filename == NULL)
- return -1;
- return b->st.st_size - a->st.st_size;
-}
-
-static int list_dir(FILE*, const char*, int);
-
-static int
-find_log10(int num)
-{
- int i = 1;
- while(num > 10) {
- i++;
- num /= 10;
- }
- return i;
-}
-
-/*
- * Operate as lstat but fake up entries for AFS mount points so we don't
- * have to fetch them.
- */
-
-#ifdef KRB5
-static int do_the_afs_dance = 1;
-#endif
-
-static int
-lstat_file (const char *file, struct stat *sb)
-{
-#ifdef KRB5
- if (do_the_afs_dance &&
- k_hasafs()
- && strcmp(file, ".")
- && strcmp(file, "..")
- && strcmp(file, "/"))
- {
- struct ViceIoctl a_params;
- char *dir, *last;
- char *path_bkp;
- static ino_t ino_counter = 0, ino_last = 0;
- int ret;
- const int maxsize = 2048;
-
- path_bkp = strdup (file);
- if (path_bkp == NULL)
- return -1;
-
- a_params.out = malloc (maxsize);
- if (a_params.out == NULL) {
- free (path_bkp);
- return -1;
- }
-
- /* If path contains more than the filename alone - split it */
-
- last = strrchr (path_bkp, '/');
- if (last != NULL) {
- if(last[1] == '\0')
- /* if path ended in /, replace with `.' */
- a_params.in = ".";
- else
- a_params.in = last + 1;
- while(last > path_bkp && *--last == '/');
- if(*last != '/' || last != path_bkp) {
- *++last = '\0';
- dir = path_bkp;
- } else
- /* we got to the start, so this must be the root dir */
- dir = "/";
- } else {
- /* file is relative to cdir */
- dir = ".";
- a_params.in = path_bkp;
- }
-
- a_params.in_size = strlen (a_params.in) + 1;
- a_params.out_size = maxsize;
-
- ret = k_pioctl (dir, VIOC_AFS_STAT_MT_PT, &a_params, 0);
- free (a_params.out);
- if (ret < 0) {
- free (path_bkp);
-
- if (errno != EINVAL)
- return ret;
- else
- /* if we get EINVAL this is probably not a mountpoint */
- return lstat (file, sb);
- }
-
- /*
- * wow this was a mountpoint, lets cook the struct stat
- * use . as a prototype
- */
-
- ret = lstat (dir, sb);
- free (path_bkp);
- if (ret < 0)
- return ret;
-
- if (ino_last == sb->st_ino)
- ino_counter++;
- else {
- ino_last = sb->st_ino;
- ino_counter = 0;
- }
- sb->st_ino += ino_counter;
- sb->st_nlink = 3;
-
- return 0;
- }
-#endif /* KRB5 */
- return lstat (file, sb);
-}
-
-#define IS_DOT_DOTDOT(X) ((X)[0] == '.' && ((X)[1] == '\0' || \
- ((X)[1] == '.' && (X)[2] == '\0')))
-
-static int
-list_files(FILE *out, const char **files, int n_files, int flags)
-{
- struct fileinfo *fi;
- int i;
- int *dirs = NULL;
- size_t total_blocks = 0;
- int n_print = 0;
- int ret = 0;
-
- if(n_files == 0)
- return 0;
-
- if(n_files > 1)
- flags |= LS_SHOW_DIRNAME;
-
- fi = calloc(n_files, sizeof(*fi));
- if (fi == NULL) {
- syslog(LOG_ERR, "out of memory");
- return -1;
- }
- for(i = 0; i < n_files; i++) {
- if(lstat_file(files[i], &fi[i].st) < 0) {
- sec_fprintf2(out, "%s: %s\r\n", files[i], strerror(errno));
- fi[i].filename = NULL;
- } else {
- int include_in_list = 1;
- total_blocks += block_convert(fi[i].st.st_blocks);
- if(S_ISDIR(fi[i].st.st_mode)) {
- if(dirs == NULL)
- dirs = calloc(n_files, sizeof(*dirs));
- if(dirs == NULL) {
- syslog(LOG_ERR, "%s: %m", files[i]);
- ret = -1;
- goto out;
- }
- dirs[i] = 1;
- if((flags & LS_DIRS) == 0)
- include_in_list = 0;
- }
- if(include_in_list) {
- ret = make_fileinfo(out, files[i], &fi[i], flags);
- if (ret)
- goto out;
- n_print++;
- }
- }
- }
- switch(SORT_MODE(flags)) {
- case LS_SORT_NAME:
- qsort(fi, n_files, sizeof(*fi),
- (int (*)(const void*, const void*))compare_filename);
- break;
- case LS_SORT_MTIME:
- qsort(fi, n_files, sizeof(*fi),
- (int (*)(const void*, const void*))compare_mtime);
- break;
- case LS_SORT_SIZE:
- qsort(fi, n_files, sizeof(*fi),
- (int (*)(const void*, const void*))compare_size);
- break;
- }
- if(DISP_MODE(flags) == LS_DISP_LONG) {
- int max_inode = 0;
- int max_bsize = 0;
- int max_n_link = 0;
- int max_user = 0;
- int max_group = 0;
- int max_size = 0;
- int max_major = 0;
- int max_minor = 0;
- int max_date = 0;
- for(i = 0; i < n_files; i++) {
- if(fi[i].filename == NULL)
- continue;
- if(fi[i].inode > max_inode)
- max_inode = fi[i].inode;
- if(fi[i].bsize > max_bsize)
- max_bsize = fi[i].bsize;
- if(fi[i].n_link > max_n_link)
- max_n_link = fi[i].n_link;
- if(strlen(fi[i].user) > max_user)
- max_user = strlen(fi[i].user);
- if(strlen(fi[i].group) > max_group)
- max_group = strlen(fi[i].group);
- if(fi[i].major != NULL && strlen(fi[i].major) > max_major)
- max_major = strlen(fi[i].major);
- if(fi[i].minor != NULL && strlen(fi[i].minor) > max_minor)
- max_minor = strlen(fi[i].minor);
- if(fi[i].size != NULL && strlen(fi[i].size) > max_size)
- max_size = strlen(fi[i].size);
- if(strlen(fi[i].date) > max_date)
- max_date = strlen(fi[i].date);
- }
- if(max_size < max_major + max_minor + 2)
- max_size = max_major + max_minor + 2;
- else if(max_size - max_minor - 2 > max_major)
- max_major = max_size - max_minor - 2;
- max_inode = find_log10(max_inode);
- max_bsize = find_log10(max_bsize);
- max_n_link = find_log10(max_n_link);
-
- if(n_print > 0)
- sec_fprintf2(out, "total %lu\r\n", (unsigned long)total_blocks);
- if(flags & LS_SORT_REVERSE)
- for(i = n_files - 1; i >= 0; i--)
- print_file(out,
- flags,
- &fi[i],
- max_inode,
- max_bsize,
- max_n_link,
- max_user,
- max_group,
- max_size,
- max_major,
- max_minor,
- max_date);
- else
- for(i = 0; i < n_files; i++)
- print_file(out,
- flags,
- &fi[i],
- max_inode,
- max_bsize,
- max_n_link,
- max_user,
- max_group,
- max_size,
- max_major,
- max_minor,
- max_date);
- } else if(DISP_MODE(flags) == LS_DISP_COLUMN ||
- DISP_MODE(flags) == LS_DISP_CROSS) {
- int max_len = 0;
- int size_len = 0;
- int num_files = n_files;
- int columns;
- int j;
- for(i = 0; i < n_files; i++) {
- if(fi[i].filename == NULL) {
- num_files--;
- continue;
- }
- if(strlen(fi[i].filename) > max_len)
- max_len = strlen(fi[i].filename);
- if(find_log10(fi[i].bsize) > size_len)
- size_len = find_log10(fi[i].bsize);
- }
- if(num_files == 0)
- goto next;
- if(flags & LS_SIZE) {
- columns = 80 / (size_len + 1 + max_len + 1);
- max_len = 80 / columns - size_len - 1;
- } else {
- columns = 80 / (max_len + 1); /* get space between columns */
- max_len = 80 / columns;
- }
- if(flags & LS_SIZE)
- sec_fprintf2(out, "total %lu\r\n",
- (unsigned long)total_blocks);
- if(DISP_MODE(flags) == LS_DISP_CROSS) {
- for(i = 0, j = 0; i < n_files; i++) {
- if(fi[i].filename == NULL)
- continue;
- if(flags & LS_SIZE)
- sec_fprintf2(out, "%*u %-*s", size_len, fi[i].bsize,
- max_len, fi[i].filename);
- else
- sec_fprintf2(out, "%-*s", max_len, fi[i].filename);
- j++;
- if(j == columns) {
- sec_fprintf2(out, "\r\n");
- j = 0;
- }
- }
- if(j > 0)
- sec_fprintf2(out, "\r\n");
- } else {
- int skip = (num_files + columns - 1) / columns;
-
- for(i = 0; i < skip; i++) {
- for(j = i; j < n_files;) {
- while(j < n_files && fi[j].filename == NULL)
- j++;
- if(flags & LS_SIZE)
- sec_fprintf2(out, "%*u %-*s", size_len, fi[j].bsize,
- max_len, fi[j].filename);
- else
- sec_fprintf2(out, "%-*s", max_len, fi[j].filename);
- j += skip;
- }
- sec_fprintf2(out, "\r\n");
- }
- }
- } else {
- for(i = 0; i < n_files; i++) {
- if(fi[i].filename == NULL)
- continue;
- sec_fprintf2(out, "%s\r\n", fi[i].filename);
- }
- }
- next:
- if(((flags & LS_DIRS) == 0 || (flags & LS_RECURSIVE)) && dirs != NULL) {
- for(i = 0; i < n_files; i++) {
- if(dirs[i]) {
- const char *p = strrchr(files[i], '/');
- if(p == NULL)
- p = files[i];
- else
- p++;
- if(!(flags & LS_DIR_FLAG) || !IS_DOT_DOTDOT(p)) {
- if((flags & LS_SHOW_DIRNAME)) {
- if ((flags & LS_EXTRA_BLANK))
- sec_fprintf2(out, "\r\n");
- sec_fprintf2(out, "%s:\r\n", files[i]);
- }
- list_dir(out, files[i], flags | LS_DIRS | LS_EXTRA_BLANK);
- }
- }
- }
- }
- out:
- for(i = 0; i < n_files; i++)
- free_fileinfo(&fi[i]);
- free(fi);
- if(dirs != NULL)
- free(dirs);
- return ret;
-}
-
-static void
-free_files (char **files, int n)
-{
- int i;
-
- for (i = 0; i < n; ++i)
- free (files[i]);
- free (files);
-}
-
-static int
-hide_file(const char *filename, int flags)
-{
- if(filename[0] != '.')
- return 0;
- if((flags & LS_IGNORE_DOT))
- return 1;
- if(filename[1] == '\0' || (filename[1] == '.' && filename[2] == '\0')) {
- if((flags & LS_SHOW_ALL))
- return 0;
- else
- return 1;
- }
- return 0;
-}
-
-static int
-list_dir(FILE *out, const char *directory, int flags)
-{
- DIR *d = opendir(directory);
- struct dirent *ent;
- char **files = NULL;
- int n_files = 0;
- int ret;
-
- if(d == NULL) {
- syslog(LOG_ERR, "%s: %m", directory);
- return -1;
- }
- while((ent = readdir(d)) != NULL) {
- void *tmp;
-
- if(hide_file(ent->d_name, flags))
- continue;
- tmp = realloc(files, (n_files + 1) * sizeof(*files));
- if (tmp == NULL) {
- syslog(LOG_ERR, "%s: out of memory", directory);
- free_files (files, n_files);
- closedir (d);
- return -1;
- }
- files = tmp;
- ret = asprintf(&files[n_files], "%s/%s", directory, ent->d_name);
- if (ret == -1) {
- syslog(LOG_ERR, "%s: out of memory", directory);
- free_files (files, n_files);
- closedir (d);
- return -1;
- }
- ++n_files;
- }
- closedir(d);
- return list_files(out, (const char**)files, n_files, flags | LS_DIR_FLAG);
-}
-
-static int
-parse_flags(const char *options)
-{
-#ifdef TEST
- int flags = LS_SORT_NAME | LS_IGNORE_DOT | LS_DISP_COLUMN;
-#else
- int flags = LS_SORT_NAME | LS_IGNORE_DOT | LS_DISP_LONG;
-#endif
-
- const char *p;
- if(options == NULL || *options != '-')
- return flags;
- for(p = options + 1; *p; p++) {
- switch(*p) {
- case '1':
- flags = (flags & ~LS_DISP_MODE);
- break;
- case 'a':
- flags |= LS_SHOW_ALL;
- /*FALLTHROUGH*/
- case 'A':
- flags &= ~LS_IGNORE_DOT;
- break;
- case 'C':
- flags = (flags & ~LS_DISP_MODE) | LS_DISP_COLUMN;
- break;
- case 'd':
- flags |= LS_DIRS;
- break;
- case 'f':
- flags = (flags & ~LS_SORT_MODE);
- break;
- case 'F':
- flags |= LS_TYPE;
- break;
- case 'i':
- flags |= LS_INODE;
- break;
- case 'l':
- flags = (flags & ~LS_DISP_MODE) | LS_DISP_LONG;
- break;
- case 'r':
- flags |= LS_SORT_REVERSE;
- break;
- case 'R':
- flags |= LS_RECURSIVE;
- break;
- case 's':
- flags |= LS_SIZE;
- break;
- case 'S':
- flags = (flags & ~LS_SORT_MODE) | LS_SORT_SIZE;
- break;
- case 't':
- flags = (flags & ~LS_SORT_MODE) | LS_SORT_MTIME;
- break;
- case 'x':
- flags = (flags & ~LS_DISP_MODE) | LS_DISP_CROSS;
- break;
- /* these are a bunch of unimplemented flags from BSD ls */
- case 'k': /* display sizes in kB */
- case 'c': /* last change time */
- case 'L': /* list symlink target */
- case 'm': /* stream output */
- case 'o': /* BSD file flags */
- case 'p': /* display / after directories */
- case 'q': /* print non-graphic characters */
- case 'u': /* use last access time */
- case 'T': /* display complete time */
- case 'W': /* include whiteouts */
- break;
- }
- }
- return flags;
-}
-
-int
-builtin_ls(FILE *out, const char *file)
-{
- int flags;
- int ret;
-
- if(*file == '-') {
- flags = parse_flags(file);
- file = ".";
- } else
- flags = parse_flags("");
-
- ret = list_files(out, &file, 1, flags);
- sec_fflush(out);
- return ret;
-}
diff --git a/appl/ftp/ftpd/pathnames.h b/appl/ftp/ftpd/pathnames.h
deleted file mode 100644
index 884902905e3e..000000000000
--- a/appl/ftp/ftpd/pathnames.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)pathnames.h 8.1 (Berkeley) 6/4/93
- */
-
-#ifdef HAVE_PATHS_H
-#include <paths.h>
-#endif
-
-#ifndef _PATH_DEVNULL
-#define _PATH_DEVNULL "/dev/null"
-#endif
-
-#ifndef _PATH_NOLOGIN
-#define _PATH_NOLOGIN "/etc/nologin"
-#endif
-
-#ifndef _PATH_BSHELL
-#define _PATH_BSHELL "/bin/sh"
-#endif
-
-#ifndef _PATH_FTPUSERS
-#define _PATH_FTPUSERS SYSCONFDIR "/ftpusers"
-#endif
-
-#define _PATH_FTPCHROOT SYSCONFDIR "/ftpchroot"
-#define _PATH_FTPWELCOME SYSCONFDIR "/ftpwelcome"
-#define _PATH_FTPLOGINMESG SYSCONFDIR "/motd"
-
-#ifndef _PATH_ISSUE
-#define _PATH_ISSUE SYSCONFDIR "/issue"
-#endif
-#define _PATH_ISSUE_NET SYSCONFDIR "/issue.net"
diff --git a/appl/ftp/ftpd/popen.c b/appl/ftp/ftpd/popen.c
deleted file mode 100644
index 5488472352ac..000000000000
--- a/appl/ftp/ftpd/popen.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * Copyright (c) 1988, 1993, 1994
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software written by Ken Arnold and
- * published in UNIX Review, Vol. 6, No. 8.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-RCSID("$Id$");
-#endif
-
-#include <sys/types.h>
-#ifdef TIME_WITH_SYS_TIME
-#include <sys/time.h>
-#include <time.h>
-#elif defined(HAVE_SYS_TIME_H)
-#include <sys/time.h>
-#else
-#include <time.h>
-#endif
-#ifdef HAVE_SYS_RESOURCE_H
-#include <sys/resource.h>
-#endif
-#include <sys/wait.h>
-
-#include <errno.h>
-#include <glob.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <roken.h>
-#include "extern.h"
-
-
-/*
- * Special version of popen which avoids call to shell. This ensures
- * no one may create a pipe to a hidden program as a side effect of a
- * list or dir command.
- */
-static int *pids;
-static int fds;
-
-/* return path prepended with ~ftp if that file exists, otherwise
- * return path unchanged
- */
-
-const char *
-ftp_rooted(const char *path)
-{
- static char home[MaxPathLen] = "";
- static char newpath[MaxPathLen];
- struct passwd *pwd;
-
- if(!home[0])
- if((pwd = k_getpwnam("ftp")))
- strlcpy(home, pwd->pw_dir, sizeof(home));
- snprintf(newpath, sizeof(newpath), "%s/%s", home, path);
- if(access(newpath, X_OK))
- strlcpy(newpath, path, sizeof(newpath));
- return newpath;
-}
-
-
-#define MAXARGS 100
-#define MAXGLOBS 1000
-
-FILE *
-ftpd_popen(char *program, char *type, int do_stderr, int no_glob)
-{
- char *cp;
- FILE *iop;
- int argc, gargc, pdes[2], pid;
- char **pop, *argv[MAXARGS], *gargv[MAXGLOBS];
- char *foo;
-
- if (strcmp(type, "r") && strcmp(type, "w"))
- return (NULL);
-
- if (!pids) {
-
- /* This function is ugly and should be rewritten, in
- * modern unices there is no such thing as a maximum
- * filedescriptor.
- */
-
- fds = getdtablesize();
- pids = (int*)calloc(fds, sizeof(int));
- if(!pids)
- return NULL;
- }
- if (pipe(pdes) < 0)
- return (NULL);
-
- /* break up string into pieces */
- foo = NULL;
- for (argc = 0, cp = program; argc < MAXARGS - 1; cp = NULL) {
- if (!(argv[argc++] = strtok_r(cp, " \t\n", &foo)))
- break;
- }
- argv[MAXARGS - 1] = NULL;
-
- gargv[0] = (char*)ftp_rooted(argv[0]);
- /* glob each piece */
- for (gargc = argc = 1; argv[argc] && gargc < MAXGLOBS - 1; argc++) {
- glob_t gl;
- int flags = GLOB_BRACE|GLOB_NOCHECK|GLOB_QUOTE|GLOB_TILDE
- |
-#ifdef GLOB_MAXPATH
- GLOB_MAXPATH
-#else
- GLOB_LIMIT
-#endif
- ;
-
- memset(&gl, 0, sizeof(gl));
- if (no_glob ||
- glob(argv[argc], flags, NULL, &gl) ||
- gl.gl_pathc == 0)
- gargv[gargc++] = strdup(argv[argc]);
- else
- for (pop = gl.gl_pathv;
- *pop && gargc < MAXGLOBS - 1;
- pop++)
- gargv[gargc++] = strdup(*pop);
- globfree(&gl);
- }
- gargv[gargc] = NULL;
-
- iop = NULL;
- switch(pid = fork()) {
- case -1: /* error */
- close(pdes[0]);
- close(pdes[1]);
- goto pfree;
- /* NOTREACHED */
- case 0: /* child */
- if (*type == 'r') {
- if (pdes[1] != STDOUT_FILENO) {
- dup2(pdes[1], STDOUT_FILENO);
- close(pdes[1]);
- }
- if(do_stderr)
- dup2(STDOUT_FILENO, STDERR_FILENO);
- close(pdes[0]);
- } else {
- if (pdes[0] != STDIN_FILENO) {
- dup2(pdes[0], STDIN_FILENO);
- close(pdes[0]);
- }
- close(pdes[1]);
- }
- execv(gargv[0], gargv);
- gargv[0] = argv[0];
- execv(gargv[0], gargv);
- _exit(1);
- }
- /* parent; assume fdopen can't fail... */
- if (*type == 'r') {
- iop = fdopen(pdes[0], type);
- close(pdes[1]);
- } else {
- iop = fdopen(pdes[1], type);
- close(pdes[0]);
- }
- pids[fileno(iop)] = pid;
-
-pfree:
- for (argc = 1; gargv[argc] != NULL; argc++)
- free(gargv[argc]);
-
-
- return (iop);
-}
-
-int
-ftpd_pclose(FILE *iop)
-{
- int fdes, status;
- pid_t pid;
- sigset_t sigset, osigset;
-
- /*
- * pclose returns -1 if stream is not associated with a
- * `popened' command, or, if already `pclosed'.
- */
- if (pids == 0 || pids[fdes = fileno(iop)] == 0)
- return (-1);
- fclose(iop);
- sigemptyset(&sigset);
- sigaddset(&sigset, SIGINT);
- sigaddset(&sigset, SIGQUIT);
- sigaddset(&sigset, SIGHUP);
- sigprocmask(SIG_BLOCK, &sigset, &osigset);
- while ((pid = waitpid(pids[fdes], &status, 0)) < 0 && errno == EINTR)
- continue;
- sigprocmask(SIG_SETMASK, &osigset, NULL);
- pids[fdes] = 0;
- if (pid < 0)
- return (pid);
- if (WIFEXITED(status))
- return (WEXITSTATUS(status));
- return (1);
-}
diff --git a/appl/ftp/ftpd/security.c b/appl/ftp/ftpd/security.c
deleted file mode 100644
index 86c73a168cea..000000000000
--- a/appl/ftp/ftpd/security.c
+++ /dev/null
@@ -1,883 +0,0 @@
-/*
- * Copyright (c) 1998-2002, 2005 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the Institute nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifdef FTP_SERVER
-#include "ftpd_locl.h"
-#else
-#include "ftp_locl.h"
-#endif
-
-RCSID("$Id$");
-
-static enum protection_level command_prot;
-static enum protection_level data_prot;
-static size_t buffer_size;
-
-struct buffer {
- void *data;
- size_t size;
- size_t index;
- int eof_flag;
-};
-
-static struct buffer in_buffer, out_buffer;
-int sec_complete;
-
-static struct {
- enum protection_level level;
- const char *name;
-} level_names[] = {
- { prot_clear, "clear" },
- { prot_safe, "safe" },
- { prot_confidential, "confidential" },
- { prot_private, "private" }
-};
-
-static const char *
-level_to_name(enum protection_level level)
-{
- int i;
- for(i = 0; i < sizeof(level_names) / sizeof(level_names[0]); i++)
- if(level_names[i].level == level)
- return level_names[i].name;
- return "unknown";
-}
-
-#ifndef FTP_SERVER /* not used in server */
-static enum protection_level
-name_to_level(const char *name)
-{
- int i;
- for(i = 0; i < sizeof(level_names) / sizeof(level_names[0]); i++)
- if(!strncasecmp(level_names[i].name, name, strlen(name)))
- return level_names[i].level;
- return prot_invalid;
-}
-#endif
-
-#ifdef FTP_SERVER
-
-static struct sec_server_mech *mechs[] = {
-#ifdef KRB5
- &gss_server_mech,
-#endif
- NULL
-};
-
-static struct sec_server_mech *mech;
-
-#else
-
-static struct sec_client_mech *mechs[] = {
-#ifdef KRB5
- &gss_client_mech,
-#endif
- NULL
-};
-
-static struct sec_client_mech *mech;
-
-#endif
-
-static void *app_data;
-
-int
-sec_getc(FILE *F)
-{
- if(sec_complete && data_prot) {
- char c;
- if(sec_read(fileno(F), &c, 1) <= 0)
- return EOF;
- return c;
- } else
- return getc(F);
-}
-
-static int
-block_read(int fd, void *buf, size_t len)
-{
- unsigned char *p = buf;
- int b;
- while(len) {
- b = read(fd, p, len);
- if (b == 0)
- return 0;
- else if (b < 0)
- return -1;
- len -= b;
- p += b;
- }
- return p - (unsigned char*)buf;
-}
-
-static int
-block_write(int fd, void *buf, size_t len)
-{
- unsigned char *p = buf;
- int b;
- while(len) {
- b = write(fd, p, len);
- if(b < 0)
- return -1;
- len -= b;
- p += b;
- }
- return p - (unsigned char*)buf;
-}
-
-static int
-sec_get_data(int fd, struct buffer *buf, int level)
-{
- int len;
- int b;
- void *tmp;
-
- b = block_read(fd, &len, sizeof(len));
- if (b == 0)
- return 0;
- else if (b < 0)
- return -1;
- len = ntohl(len);
- tmp = realloc(buf->data, len);
- if (tmp == NULL)
- return -1;
- buf->data = tmp;
- b = block_read(fd, buf->data, len);
- if (b == 0)
- return 0;
- else if (b < 0)
- return -1;
- buf->size = (*mech->decode)(app_data, buf->data, len, data_prot);
- buf->index = 0;
- return 0;
-}
-
-static size_t
-buffer_read(struct buffer *buf, void *dataptr, size_t len)
-{
- len = min(len, buf->size - buf->index);
- memcpy(dataptr, (char*)buf->data + buf->index, len);
- buf->index += len;
- return len;
-}
-
-static size_t
-buffer_write(struct buffer *buf, void *dataptr, size_t len)
-{
- if(buf->index + len > buf->size) {
- void *tmp;
- if(buf->data == NULL)
- tmp = malloc(1024);
- else
- tmp = realloc(buf->data, buf->index + len);
- if(tmp == NULL)
- return -1;
- buf->data = tmp;
- buf->size = buf->index + len;
- }
- memcpy((char*)buf->data + buf->index, dataptr, len);
- buf->index += len;
- return len;
-}
-
-int
-sec_read(int fd, void *dataptr, int length)
-{
- size_t len;
- int rx = 0;
-
- if(sec_complete == 0 || data_prot == 0)
- return read(fd, dataptr, length);
-
- if(in_buffer.eof_flag){
- in_buffer.eof_flag = 0;
- return 0;
- }
-
- len = buffer_read(&in_buffer, dataptr, length);
- length -= len;
- rx += len;
- dataptr = (char*)dataptr + len;
-
- while(length){
- int ret;
-
- ret = sec_get_data(fd, &in_buffer, data_prot);
- if (ret < 0)
- return -1;
- if(ret == 0 && in_buffer.size == 0) {
- if(rx)
- in_buffer.eof_flag = 1;
- return rx;
- }
- len = buffer_read(&in_buffer, dataptr, length);
- length -= len;
- rx += len;
- dataptr = (char*)dataptr + len;
- }
- return rx;
-}
-
-static int
-sec_send(int fd, char *from, int length)
-{
- int bytes;
- void *buf;
- bytes = (*mech->encode)(app_data, from, length, data_prot, &buf);
- bytes = htonl(bytes);
- block_write(fd, &bytes, sizeof(bytes));
- block_write(fd, buf, ntohl(bytes));
- free(buf);
- return length;
-}
-
-int
-sec_fflush(FILE *F)
-{
- if(data_prot != prot_clear) {
- if(out_buffer.index > 0){
- sec_write(fileno(F), out_buffer.data, out_buffer.index);
- out_buffer.index = 0;
- }
- sec_send(fileno(F), NULL, 0);
- }
- fflush(F);
- return 0;
-}
-
-int
-sec_write(int fd, char *dataptr, int length)
-{
- int len = buffer_size;
- int tx = 0;
-
- if(data_prot == prot_clear)
- return write(fd, dataptr, length);
-
- len -= (*mech->overhead)(app_data, data_prot, len);
- while(length){
- if(length < len)
- len = length;
- sec_send(fd, dataptr, len);
- length -= len;
- dataptr += len;
- tx += len;
- }
- return tx;
-}
-
-int
-sec_vfprintf2(FILE *f, const char *fmt, va_list ap)
-{
- char *buf;
- int ret;
- if(data_prot == prot_clear)
- return vfprintf(f, fmt, ap);
- else {
- int len;
- len = vasprintf(&buf, fmt, ap);
- if (len == -1)
- return len;
- ret = buffer_write(&out_buffer, buf, len);
- free(buf);
- return ret;
- }
-}
-
-int
-sec_fprintf2(FILE *f, const char *fmt, ...)
-{
- int ret;
- va_list ap;
- va_start(ap, fmt);
- ret = sec_vfprintf2(f, fmt, ap);
- va_end(ap);
- return ret;
-}
-
-int
-sec_putc(int c, FILE *F)
-{
- char ch = c;
- if(data_prot == prot_clear)
- return putc(c, F);
-
- buffer_write(&out_buffer, &ch, 1);
- if(c == '\n' || out_buffer.index >= 1024 /* XXX */) {
- sec_write(fileno(F), out_buffer.data, out_buffer.index);
- out_buffer.index = 0;
- }
- return c;
-}
-
-int
-sec_read_msg(char *s, int level)
-{
- int len;
- char *buf;
- int return_code;
-
- buf = malloc(strlen(s));
- len = base64_decode(s + 4, buf); /* XXX */
-
- len = (*mech->decode)(app_data, buf, len, level);
- if(len < 0)
- return -1;
-
- buf[len] = '\0';
-
- if(buf[3] == '-')
- return_code = 0;
- else
- sscanf(buf, "%d", &return_code);
- if(buf[len-1] == '\n')
- buf[len-1] = '\0';
- strcpy(s, buf);
- free(buf);
- return return_code;
-}
-
-int
-sec_vfprintf(FILE *f, const char *fmt, va_list ap)
-{
- char *buf;
- void *enc;
- int len;
- if(!sec_complete)
- return vfprintf(f, fmt, ap);
-
- if (vasprintf(&buf, fmt, ap) == -1) {
- printf("Failed to allocate command.\n");
- return -1;
- }
- len = (*mech->encode)(app_data, buf, strlen(buf), command_prot, &enc);
- free(buf);
- if(len < 0) {
- printf("Failed to encode command.\n");
- return -1;
- }
- if(base64_encode(enc, len, &buf) < 0){
- free(enc);
- printf("Out of memory base64-encoding.\n");
- return -1;
- }
- free(enc);
-#ifdef FTP_SERVER
- if(command_prot == prot_safe)
- fprintf(f, "631 %s\r\n", buf);
- else if(command_prot == prot_private)
- fprintf(f, "632 %s\r\n", buf);
- else if(command_prot == prot_confidential)
- fprintf(f, "633 %s\r\n", buf);
-#else
- if(command_prot == prot_safe)
- fprintf(f, "MIC %s", buf);
- else if(command_prot == prot_private)
- fprintf(f, "ENC %s", buf);
- else if(command_prot == prot_confidential)
- fprintf(f, "CONF %s", buf);
-#endif
- free(buf);
- return 0;
-}
-
-int
-sec_fprintf(FILE *f, const char *fmt, ...)
-{
- va_list ap;
- int ret;
- va_start(ap, fmt);
- ret = sec_vfprintf(f, fmt, ap);
- va_end(ap);
- return ret;
-}
-
-/* end common stuff */
-
-#ifdef FTP_SERVER
-
-int ccc_passed;
-
-void
-auth(char *auth_name)
-{
- int i;
- void *tmp;
-
- for(i = 0; (mech = mechs[i]) != NULL; i++){
- if(!strcasecmp(auth_name, mech->name)){
- tmp = realloc(app_data, mech->size);
- if (tmp == NULL) {
- reply(431, "Unable to accept %s at this time", mech->name);
- return;
- }
- app_data = tmp;
-
- if(mech->init && (*mech->init)(app_data) != 0) {
- reply(431, "Unable to accept %s at this time", mech->name);
- return;
- }
- if(mech->auth) {
- (*mech->auth)(app_data);
- return;
- }
- if(mech->adat)
- reply(334, "Send authorization data.");
- else
- reply(234, "Authorization complete.");
- return;
- }
- }
- free (app_data);
- app_data = NULL;
- reply(504, "%s is unknown to me", auth_name);
-}
-
-void
-adat(char *auth_data)
-{
- if(mech && !sec_complete) {
- void *buf = malloc(strlen(auth_data));
- size_t len;
- len = base64_decode(auth_data, buf);
- (*mech->adat)(app_data, buf, len);
- free(buf);
- } else
- reply(503, "You must %sissue an AUTH first.", mech ? "re-" : "");
-}
-
-void pbsz(int size)
-{
- size_t new = size;
- if(!sec_complete)
- reply(503, "Incomplete security data exchange.");
- if(mech->pbsz)
- new = (*mech->pbsz)(app_data, size);
- if(buffer_size != new){
- buffer_size = size;
- }
- if(new != size)
- reply(200, "PBSZ=%lu", (unsigned long)new);
- else
- reply(200, "OK");
-}
-
-void
-prot(char *pl)
-{
- int p = -1;
-
- if(buffer_size == 0){
- reply(503, "No protection buffer size negotiated.");
- return;
- }
-
- if(!strcasecmp(pl, "C"))
- p = prot_clear;
- else if(!strcasecmp(pl, "S"))
- p = prot_safe;
- else if(!strcasecmp(pl, "E"))
- p = prot_confidential;
- else if(!strcasecmp(pl, "P"))
- p = prot_private;
- else {
- reply(504, "Unrecognized protection level.");
- return;
- }
-
- if(sec_complete){
- if((*mech->check_prot)(app_data, p)){
- reply(536, "%s does not support %s protection.",
- mech->name, level_to_name(p));
- }else{
- data_prot = (enum protection_level)p;
- reply(200, "Data protection is %s.", level_to_name(p));
- }
- }else{
- reply(503, "Incomplete security data exchange.");
- }
-}
-
-void ccc(void)
-{
- if(sec_complete){
- if(mech->ccc && (*mech->ccc)(app_data) == 0) {
- command_prot = data_prot = prot_clear;
- ccc_passed = 1;
- } else
- reply(534, "You must be joking.");
- }else
- reply(503, "Incomplete security data exchange.");
-}
-
-void mec(char *msg, enum protection_level level)
-{
- void *buf;
- size_t len, buf_size;
- if(!sec_complete) {
- reply(503, "Incomplete security data exchange.");
- return;
- }
- buf_size = strlen(msg) + 2;
- buf = malloc(buf_size);
- if (buf == NULL) {
- reply(501, "Failed to allocate %lu", (unsigned long)buf_size);
- return;
- }
- len = base64_decode(msg, buf);
- command_prot = level;
- if(len == (size_t)-1) {
- free(buf);
- reply(501, "Failed to base64-decode command");
- return;
- }
- len = (*mech->decode)(app_data, buf, len, level);
- if(len == (size_t)-1) {
- free(buf);
- reply(535, "Failed to decode command");
- return;
- }
- ((char*)buf)[len] = '\0';
- if(strstr((char*)buf, "\r\n") == NULL)
- strlcat((char*)buf, "\r\n", buf_size);
- new_ftp_command(buf);
-}
-
-/* ------------------------------------------------------------ */
-
-int
-sec_userok(char *userstr)
-{
- if(sec_complete)
- return (*mech->userok)(app_data, userstr);
- return 0;
-}
-
-int
-sec_session(char *user)
-{
- if(sec_complete && mech->session)
- return (*mech->session)(app_data, user);
- return 0;
-}
-
-char *ftp_command;
-
-void
-new_ftp_command(char *command)
-{
- ftp_command = command;
-}
-
-void
-delete_ftp_command(void)
-{
- free(ftp_command);
- ftp_command = NULL;
-}
-
-int
-secure_command(void)
-{
- return ftp_command != NULL;
-}
-
-enum protection_level
-get_command_prot(void)
-{
- return command_prot;
-}
-
-#else /* FTP_SERVER */
-
-void
-sec_status(void)
-{
- if(sec_complete){
- printf("Using %s for authentication.\n", mech->name);
- printf("Using %s command channel.\n", level_to_name(command_prot));
- printf("Using %s data channel.\n", level_to_name(data_prot));
- if(buffer_size > 0)
- printf("Protection buffer size: %lu.\n",
- (unsigned long)buffer_size);
- }else{
- printf("Not using any security mechanism.\n");
- }
-}
-
-static int
-sec_prot_internal(int level)
-{
- int ret;
- char *p;
- unsigned int s = 1048576;
-
- int old_verbose = verbose;
- verbose = 0;
-
- if(!sec_complete){
- printf("No security data exchange has taken place.\n");
- return -1;
- }
-
- if(level){
- ret = command("PBSZ %u", s);
- if(ret != COMPLETE){
- printf("Failed to set protection buffer size.\n");
- return -1;
- }
- buffer_size = s;
- p = strstr(reply_string, "PBSZ=");
- if(p)
- sscanf(p, "PBSZ=%u", &s);
- if(s < buffer_size)
- buffer_size = s;
- }
- verbose = old_verbose;
- ret = command("PROT %c", level["CSEP"]); /* XXX :-) */
- if(ret != COMPLETE){
- printf("Failed to set protection level.\n");
- return -1;
- }
-
- data_prot = (enum protection_level)level;
- return 0;
-}
-
-enum protection_level
-set_command_prot(enum protection_level level)
-{
- int ret;
- enum protection_level old = command_prot;
- if(level != command_prot && level == prot_clear) {
- ret = command("CCC");
- if(ret != COMPLETE) {
- printf("Failed to clear command channel.\n");
- return prot_invalid;
- }
- }
- command_prot = level;
- return old;
-}
-
-void
-sec_prot(int argc, char **argv)
-{
- int level = -1;
-
- if(argc > 3)
- goto usage;
-
- if(argc == 1) {
- sec_status();
- return;
- }
- if(!sec_complete) {
- printf("No security data exchange has taken place.\n");
- code = -1;
- return;
- }
- level = name_to_level(argv[argc - 1]);
-
- if(level == -1)
- goto usage;
-
- if((*mech->check_prot)(app_data, level)) {
- printf("%s does not implement %s protection.\n",
- mech->name, level_to_name(level));
- code = -1;
- return;
- }
-
- if(argc == 2 || strncasecmp(argv[1], "data", strlen(argv[1])) == 0) {
- if(sec_prot_internal(level) < 0){
- code = -1;
- return;
- }
- } else if(strncasecmp(argv[1], "command", strlen(argv[1])) == 0) {
- if(set_command_prot(level) < 0) {
- code = -1;
- return;
- }
- } else
- goto usage;
- code = 0;
- return;
- usage:
- printf("usage: %s [command|data] [clear|safe|confidential|private]\n",
- argv[0]);
- code = -1;
-}
-
-void
-sec_prot_command(int argc, char **argv)
-{
- int level;
-
- if(argc > 2)
- goto usage;
-
- if(!sec_complete) {
- printf("No security data exchange has taken place.\n");
- code = -1;
- return;
- }
-
- if(argc == 1) {
- sec_status();
- } else {
- level = name_to_level(argv[1]);
- if(level == -1)
- goto usage;
-
- if((*mech->check_prot)(app_data, level)) {
- printf("%s does not implement %s protection.\n",
- mech->name, level_to_name(level));
- code = -1;
- return;
- }
- if(set_command_prot(level) < 0) {
- code = -1;
- return;
- }
- }
- code = 0;
- return;
- usage:
- printf("usage: %s [clear|safe|confidential|private]\n",
- argv[0]);
- code = -1;
-}
-
-static enum protection_level request_data_prot;
-
-void
-sec_set_protection_level(void)
-{
- if(sec_complete && data_prot != request_data_prot)
- sec_prot_internal(request_data_prot);
-}
-
-
-int
-sec_request_prot(char *level)
-{
- int l = name_to_level(level);
- if(l == -1)
- return -1;
- request_data_prot = (enum protection_level)l;
- return 0;
-}
-
-int
-sec_login(char *host)
-{
- int ret;
- struct sec_client_mech **m;
- int old_verbose = verbose;
-
- verbose = -1; /* shut up all messages this will produce (they
- are usually not very user friendly) */
-
- for(m = mechs; *m && (*m)->name; m++) {
- void *tmp;
-
- tmp = realloc(app_data, (*m)->size);
- if (tmp == NULL) {
- warnx ("realloc %lu failed", (unsigned long)(*m)->size);
- return -1;
- }
- app_data = tmp;
-
- if((*m)->init && (*(*m)->init)(app_data) != 0) {
- printf("Skipping %s...\n", (*m)->name);
- continue;
- }
- printf("Trying %s...\n", (*m)->name);
- ret = command("AUTH %s", (*m)->name);
- if(ret != CONTINUE){
- if(code == 504){
- printf("%s is not supported by the server.\n", (*m)->name);
- }else if(code == 534){
- printf("%s rejected as security mechanism.\n", (*m)->name);
- }else if(ret == ERROR) {
- printf("The server doesn't support the FTP "
- "security extensions.\n");
- verbose = old_verbose;
- return -1;
- }
- continue;
- }
-
- ret = (*(*m)->auth)(app_data, host);
-
- if(ret == AUTH_CONTINUE)
- continue;
- else if(ret != AUTH_OK){
- /* mechanism is supposed to output error string */
- verbose = old_verbose;
- return -1;
- }
- mech = *m;
- sec_complete = 1;
- if(doencrypt) {
- command_prot = prot_private;
- request_data_prot = prot_private;
- } else {
- command_prot = prot_safe;
- }
- break;
- }
-
- verbose = old_verbose;
- return *m == NULL;
-}
-
-void
-sec_end(void)
-{
- if (mech != NULL) {
- if(mech->end)
- (*mech->end)(app_data);
- if (app_data != NULL) {
- memset(app_data, 0, mech->size);
- free(app_data);
- app_data = NULL;
- }
- }
- sec_complete = 0;
- data_prot = (enum protection_level)0;
-}
-
-#endif /* FTP_SERVER */
-