version 1.79, 2004/07/16 08:29:28 |
version 1.80, 2004/08/09 12:56:47 |
|
|
/* $NetBSD$ */ |
/* $NetBSD$ */ |
|
|
/*- |
/*- |
* Copyright (c) 1997-2002 The NetBSD Foundation, Inc. |
* Copyright (c) 1997-2004 The NetBSD Foundation, Inc. |
* All rights reserved. |
* All rights reserved. |
* |
* |
* This code is derived from software contributed to The NetBSD Foundation |
* This code is derived from software contributed to The NetBSD Foundation |
Line 94 __RCSID("$NetBSD$"); |
|
Line 94 __RCSID("$NetBSD$"); |
|
#include <ctype.h> |
#include <ctype.h> |
#include <errno.h> |
#include <errno.h> |
#include <pwd.h> |
#include <pwd.h> |
#include <setjmp.h> |
|
#include <signal.h> |
|
#include <stdio.h> |
#include <stdio.h> |
#include <stdlib.h> |
#include <stdlib.h> |
#include <string.h> |
#include <string.h> |
|
|
A B C E F I |
A B C E F I |
L N P R S T |
L N P R S T |
|
|
SP CRLF COMMA |
SP CRLF COMMA ALL |
|
|
USER PASS ACCT CWD CDUP SMNT |
USER PASS ACCT CWD CDUP SMNT |
QUIT REIN PORT PASV TYPE STRU |
QUIT REIN PORT PASV TYPE STRU |
|
|
LEXERR |
LEXERR |
|
|
%token <s> STRING |
%token <s> STRING |
%token <s> ALL |
|
%token <u> NUMBER |
%token <u> NUMBER |
|
|
%type <u.i> check_login octal_number byte_size |
%type <u.i> check_login octal_number byte_size |
Line 1299 struct tab sitetab[] = { |
|
Line 1296 struct tab sitetab[] = { |
|
static int check_write(const char *, int); |
static int check_write(const char *, int); |
static void help(struct tab *, const char *); |
static void help(struct tab *, const char *); |
static void port_check(const char *, int); |
static void port_check(const char *, int); |
static void toolong(int); |
|
int yylex(void); |
int yylex(void); |
|
|
extern int epsvall; |
extern int epsvall; |
Line 1446 getline(char *s, int n, FILE *iop) |
|
Line 1442 getline(char *s, int n, FILE *iop) |
|
return (s); |
return (s); |
} |
} |
|
|
static void |
|
toolong(int signo) |
|
{ |
|
|
|
reply(421, |
|
"Timeout (" LLF " seconds): closing control connection.", |
|
(LLT)curclass.timeout); |
|
if (logging) |
|
syslog(LOG_INFO, "User %s timed out after " LLF " seconds", |
|
(pw ? pw->pw_name : "unknown"), (LLT)curclass.timeout); |
|
dologout(1); |
|
} |
|
|
|
void |
void |
ftp_handle_line(char *cp) |
ftp_handle_line(char *cp) |
{ |
{ |
|
|
{ |
{ |
|
|
while (1) { |
while (1) { |
(void) signal(SIGALRM, toolong); |
|
(void) alarm(curclass.timeout); |
(void) alarm(curclass.timeout); |
if (getline(cbuf, sizeof(cbuf)-1, stdin) == NULL) { |
if (getline(cbuf, sizeof(cbuf)-1, stdin) == NULL) { |
reply(221, "You could at least say goodbye."); |
reply(221, "You could at least say goodbye."); |
|
|
return (NUMBER); |
return (NUMBER); |
} |
} |
if (strncasecmp(&cmdp[cpos], "ALL", 3) == 0 |
if (strncasecmp(&cmdp[cpos], "ALL", 3) == 0 |
&& !isalnum(cmdp[cpos + 3])) { |
&& !isalnum(cmdp[cpos + 3])) { |
yylval.s = xstrdup("ALL"); |
|
cpos += 3; |
cpos += 3; |
return ALL; |
return (ALL); |
} |
} |
switch (cmdp[cpos++]) { |
switch (cmdp[cpos++]) { |
|
|
|
|
} |
} |
yyerror(NULL); |
yyerror(NULL); |
state = CMD; |
state = CMD; |
is_oob = 0; |
return (0); |
longjmp(errcatch, 0); |
|
/* NOTREACHED */ |
|
} |
} |
|
|
/* ARGSUSED */ |
/* ARGSUSED */ |