You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

716 lines
13 KiB

# --- T2-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# T2 SDE: package/.../wu-ftpd/ftpcmd_y_fix.patch
# Copyright (C) 2004 - 2006 The T2 SDE Project
# Copyright (C) 1998 - 2003 Clifford Wolf
#
# More information can be found in the files COPYING and README.
#
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# --- T2-COPYRIGHT-NOTE-END ---
--- ./src/ftpcmd.y.orig 2003-01-26 17:59:52.000000000 +0100
+++ ./src/ftpcmd.y 2003-01-26 18:03:50.000000000 +0100
@@ -194,7 +194,7 @@
cmd_list: /* empty */
| cmd_list cmd
- = {
+ {
fromname = (char *) NULL;
restart_point = 0;
}
@@ -202,14 +202,14 @@
;
cmd: USER SP username CRLF
- = {
+ {
user($3);
if (log_commands)
syslog(LOG_INFO, "USER %s", $3);
free($3);
}
| PASS SP password CRLF
- = {
+ {
if (log_commands)
if (anonymous)
syslog(LOG_INFO, "PASS %s", $3);
@@ -220,7 +220,7 @@
free($3);
}
| PORT check_login SP host_port CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "PORT");
/* H* port fix, part B: admonish the twit.
@@ -252,7 +252,7 @@
}
}
| PASV check_login CRLF
- = {
+ {
/* Require login for PASV, too. This actually fixes a bug -- telnet to an
unfixed wu-ftpd and type PASV first off, and it crashes! */
if (log_commands)
@@ -265,7 +265,7 @@
#endif
}
| TYPE check_login SP type_code CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "TYPE %s", typenames[cmd_type]);
if ($2)
@@ -305,7 +305,7 @@
}
}
| STRU check_login SP struct_code CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "STRU %s", strunames[$4]);
if ($2)
@@ -320,7 +320,7 @@
}
}
| MODE check_login SP mode_code CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "MODE %s", modenames[$4]);
if ($2)
@@ -335,21 +335,21 @@
}
}
| ALLO check_login SP NUMBER CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "ALLO %d", $4);
if ($2)
reply(202, "ALLO command ignored.");
}
| ALLO check_login SP NUMBER SP R SP NUMBER CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "ALLO %d R %d", $4, $8);
if ($2)
reply(202, "ALLO command ignored.");
}
| RETR check_login SP pathname CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "RETR %s", CHECKNULL($4));
if ($2 && $4 != NULL && !restrict_check($4)) {
@@ -360,7 +360,7 @@
free($4);
}
| STOR check_login SP pathname CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "STOR %s", CHECKNULL($4));
if ($2 && $4 != NULL && !restrict_check($4))
@@ -369,7 +369,7 @@
free($4);
}
| APPE check_login SP pathname CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "APPE %s", CHECKNULL($4));
if ($2 && $4 != NULL && !restrict_check($4))
@@ -378,14 +378,14 @@
free($4);
}
| NLST check_login CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "NLST");
if ($2 && !restrict_check("."))
send_file_list("");
}
| NLST check_login SP STRING CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "NLST %s", $4);
if ($2 && $4 && !restrict_check($4))
@@ -394,7 +394,7 @@
free($4);
}
| LIST check_login CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "LIST");
if ($2 && !restrict_check(".")) {
@@ -410,7 +410,7 @@
}
}
| LIST check_login SP pathname CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "LIST %s", CHECKNULL($4));
if ($2 && $4 != NULL && !restrict_list_check($4)) {
@@ -428,7 +428,7 @@
free($4);
}
| STAT check_login SP pathname CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "STAT %s", CHECKNULL($4));
if ($2 && $4 != NULL && !restrict_check($4))
@@ -437,14 +437,14 @@
free($4);
}
| STAT check_login CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "STAT");
if ($2)
statcmd();
}
| DELE check_login SP pathname CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "DELE %s", CHECKNULL($4));
if ($2 && $4 != NULL && !restrict_check($4))
@@ -453,7 +453,7 @@
free($4);
}
| RNTO check_login SP pathname CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "RNTO %s", CHECKNULL($4));
if ($2 && $4 && !restrict_check($4)) {
@@ -470,21 +470,21 @@
free($4);
}
| ABOR check_login CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "ABOR");
if ($2)
reply(225, "ABOR command successful.");
}
| CWD check_login CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "CWD");
if ($2 && !restrict_check(home))
cwd(home);
}
| CWD check_login SP pathname CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "CWD %s", CHECKNULL($4));
if ($2 && $4 != NULL && !restrict_check($4))
@@ -493,14 +493,14 @@
free($4);
}
| HELP check_login CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "HELP");
if ($2)
help(cmdtab, (char *) NULL);
}
| HELP check_login SP STRING CRLF
- = {
+ {
register char *cp = (char *) $4;
if (log_commands)
@@ -521,14 +521,14 @@
free($4);
}
| NOOP check_login CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "NOOP");
if ($2)
reply(200, "NOOP command successful.");
}
| MKD check_login SP pathname CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "MKD %s", CHECKNULL($4));
if ($2 && $4 != NULL && !restrict_check($4))
@@ -537,7 +537,7 @@
free($4);
}
| RMD check_login SP pathname CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "RMD %s", CHECKNULL($4));
if ($2 && $4 != NULL && !restrict_check($4))
@@ -546,14 +546,14 @@
free($4);
}
| PWD check_login CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "PWD");
if ($2)
pwd();
}
| CDUP check_login CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "CDUP");
if ($2)
@@ -564,14 +564,14 @@
}
| SITE check_login SP HELP CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "SITE HELP");
if ($2)
help(sitetab, (char *) NULL);
}
| SITE check_login SP HELP SP STRING CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "SITE HELP %s", $6);
if ($2)
@@ -580,7 +580,7 @@
free($6);
}
| SITE check_login SP UMASK CRLF
- = {
+ {
mode_t oldmask;
if (log_commands)
@@ -592,7 +592,7 @@
}
}
| SITE check_login SP UMASK SP octal_number CRLF
- = {
+ {
mode_t oldmask;
struct aclmember *entry = NULL;
int ok = 1;
@@ -620,7 +620,7 @@
}
}
| SITE check_login SP CHMOD SP octal_number SP pathname CRLF
- = {
+ {
struct aclmember *entry = NULL;
int ok = (anonymous ? 0 : 1);
@@ -670,7 +670,7 @@
free($8);
}
| SITE check_login SP IDLE CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "SITE IDLE");
if ($2)
@@ -679,7 +679,7 @@
timeout_idle, timeout_maxidle);
}
| SITE check_login SP IDLE SP NUMBER CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "SITE IDLE %d", $6);
if ($2)
@@ -694,7 +694,7 @@
}
}
| SITE check_login SP GROUP SP username CRLF
- = {
+ {
#ifndef NO_PRIVATE
if (log_commands)
syslog(LOG_INFO, "SITE GROUP %s", $6);
@@ -704,7 +704,7 @@
#endif /* !NO_PRIVATE */
}
| SITE check_login SP GPASS SP password CRLF
- = {
+ {
#ifndef NO_PRIVATE
if (log_commands)
syslog(LOG_INFO, "SITE GPASS password");
@@ -714,7 +714,7 @@
#endif /* !NO_PRIVATE */
}
| SITE check_login SP GPASS CRLF
- = {
+ {
#ifndef NO_PRIVATE
if (log_commands)
syslog(LOG_INFO, "SITE GPASS");
@@ -723,7 +723,7 @@
#endif /* !NO_PRIVATE */
}
| SITE check_login SP NEWER SP STRING CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "SITE NEWER %s", $6);
#ifdef SITE_NEWER
@@ -735,7 +735,7 @@
free($6);
}
| SITE check_login SP NEWER SP STRING SP pathname CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "SITE NEWER %s %s", $6,
CHECKNULL($8));
@@ -750,7 +750,7 @@
free($8);
}
| SITE check_login SP MINFO SP STRING CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "SITE MINFO %s", $6);
#ifdef SITE_NEWER
@@ -762,7 +762,7 @@
free($6);
}
| SITE check_login SP MINFO SP STRING SP pathname CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "SITE MINFO %s %s", $6,
CHECKNULL($8));
@@ -777,7 +777,7 @@
free($8);
}
| SITE check_login SP INDEX SP STRING CRLF
- = {
+ {
/* this is just for backward compatibility since we
* thought of INDEX before we thought of EXEC
*/
@@ -792,7 +792,7 @@
free($6);
}
| SITE check_login SP EXEC SP STRING CRLF
- = {
+ {
if (!restricted_user && $2 != 0 && $6 != NULL) {
(void) site_exec((char *) $6);
}
@@ -801,7 +801,7 @@
}
| STOU check_login SP pathname CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "STOU %s", CHECKNULL($4));
if ($2 && $4 && !restrict_check($4))
@@ -810,7 +810,7 @@
free($4);
}
| SYST check_login CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "SYST");
if ($2)
@@ -834,7 +834,7 @@
* using with RESTART (we just count bytes).
*/
| SIZE check_login SP pathname CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "SIZE %s", CHECKNULL($4));
if ($2 && $4 && !restrict_check($4)) {
@@ -854,7 +854,7 @@
* not necessarily 3 digits)
*/
| MDTM check_login SP pathname CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "MDTM %s", CHECKNULL($4));
if ($2 && $4 && !restrict_check($4)) {
@@ -879,7 +879,7 @@
free($4);
}
| QUIT CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "QUIT");
#ifdef TRANSFER_COUNT
@@ -893,13 +893,13 @@
dologout(0);
}
| error CRLF
- = {
+ {
yyerrok;
}
;
rcmd: RNFR check_login SP pathname CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "RNFR %s", CHECKNULL($4));
@@ -912,7 +912,7 @@
free($4);
}
| REST check_login SP byte_size CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "REST %d", (int) restart_point);
if ($2) {
@@ -924,14 +924,14 @@
}
| SITE check_login SP ALIAS CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "SITE ALIAS");
if ($2)
alias((char *) NULL);
}
| SITE check_login SP ALIAS SP STRING CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "SITE ALIAS %s", $6);
if ($2)
@@ -940,21 +940,21 @@
free($6);
}
| SITE check_login SP GROUPS CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "SITE GROUPS");
if ($2)
print_groups();
}
| SITE check_login SP CDPATH CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "SITE CDPATH");
if ($2)
cdpath();
}
| SITE check_login SP CHECKMETHOD SP method CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "SITE CHECKMETHOD %s", CHECKNULL($6));
if (($2) && ($6 != NULL))
@@ -963,14 +963,14 @@
free($6);
}
| SITE check_login SP CHECKMETHOD CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "SITE CHECKMETHOD");
if ($2)
ShowCheckMethod();
}
| SITE check_login SP CHECKSUM SP pathname CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "SITE CHECKSUM %s", CHECKNULL($6));
if (($2) && ($6 != NULL) && (!restrict_check($6)))
@@ -979,7 +979,7 @@
free($6);
}
| SITE check_login SP CHECKSUM CRLF
- = {
+ {
if (log_commands)
syslog(LOG_INFO, "SITE CHECKSUM");
if ($2)
@@ -991,7 +991,7 @@
;
password: /* empty */
- = {
+ {
$$ = (char *) malloc(1);
$$[0] = '\0';
}
@@ -1002,7 +1002,7 @@
;
host_port: NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER
- = {
+ {
register char *a, *p;
a = (char *) &cliaddr;
@@ -1017,91 +1017,91 @@
;
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.
@@ -1193,7 +1193,7 @@
;
octal_number: NUMBER
- = {
+ {
register int ret, dec, multby, digit;
/*
@@ -1218,7 +1218,7 @@
;
check_login: /* empty */
- = {
+ {
if (logged_in)
$$ = 1;
else {