ftpd.c File Reference

#include <sys/types.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <net/gen/in.h>
#include <net/gen/tcp.h>
#include "ftpd.h"
#include "access.h"
#include "file.h"
#include "net.h"

Include dependency graph for ftpd.c:

Go to the source code of this file.

Data Structures

struct  commands

Defines

#define INACTIVITY_TIMEOUT   60*5
#define FTPD_LOG   "/usr/adm/ftpd.log"
#define FTPD_MSG   "/etc/ftpd_msg"

Functions

 _PROTOTYPE (static void init,(void))
 _PROTOTYPE (static int doHELP,(char *buff))
 _PROTOTYPE (static int getline,(char *line, int len))
 _PROTOTYPE (int readline,(char **args))
 _PROTOTYPE (void Timeout,(int sig))
 _PROTOTYPE (int main,(int argc, char *argv[]))
static void init ()
static int doNOOP (char *buff)
static int doHELP (char *buff)
static int doUNIMP (char *buff)
void cvtline (char **args)
static int getline (char *line, int len)
int readline (char **args)
void Timeout (int sig)
void logit (char *type, char *parm)
void showmsg (char *reply, char *filename)
int main (int argc, argv)

Variables

char * FtpdVersion = "2.00"
FILEmsgfile = (FILE *)NULL
char * days [] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}
char * months []
char line [512]
int type
int format
int mode
int structure
int ftpdata_fd = -1
int loggedin
int gotuser
int anonymous
char username [80]
char anonpass [128]
char newroot [128]
ipaddr_t myipaddr
ipaddr_t rmtipaddr
ipaddr_t dataaddr
tcpport_t myport
tcpport_t rmtport
tcpport_t dataport
char myhostname [256]
char rmthostname [256]
FILElogfile
int timeout = 0
commands commands []


Define Documentation

#define FTPD_LOG   "/usr/adm/ftpd.log"
 

Definition at line 71 of file ftpd.c.

Referenced by main().

#define FTPD_MSG   "/etc/ftpd_msg"
 

Definition at line 72 of file ftpd.c.

Referenced by main().

#define INACTIVITY_TIMEOUT   60*5
 

Definition at line 51 of file ftpd.c.

Referenced by main().


Function Documentation

_PROTOTYPE int  main,
(int argc, char *argv[]) 
 

_PROTOTYPE void  Timeout,
(int sig
 

_PROTOTYPE int  readline,
(char **args
 

_PROTOTYPE static int  getline,
(char *line, int len) 
 

_PROTOTYPE static int  doHELP,
(char *buff) 
 

_PROTOTYPE static void  init,
(void) 
 

void cvtline char **  args  ) 
 

Definition at line 199 of file ftpd.c.

References isspace, logit(), p, strlen(), and toupper.

Referenced by doSITE(), and readline().

static int doHELP char *  buff  )  [static]
 

Definition at line 157 of file ftpd.c.

References cmd, commands, i, printf, space(), star(), and strlen().

static int doNOOP char *  buff  )  [static]
 

Definition at line 148 of file ftpd.c.

References GOOD, and printf.

static int doUNIMP char *  buff  )  [static]
 

Definition at line 190 of file ftpd.c.

References GOOD, and printf.

static int getline char *  line,
int  len
[static]
 

Definition at line 234 of file ftpd.c.

References read, and s.

static void init  )  [static]
 

Definition at line 132 of file ftpd.c.

References MODE_S, and TYPE_A.

void logit char *  type,
char *  parm
 

Definition at line 287 of file ftpd.c.

References fflush(), fprintf(), localtime(), logfile, now, NULL, time, time_t, tm::tm_hour, tm::tm_mday, tm::tm_min, tm::tm_mon, tm::tm_sec, and tm::tm_year.

Referenced by AreWeIn(), cvtline(), doDELE(), doMKD(), doPASS(), doRMD(), doRNTO(), main(), recvfile(), and sendfile().

int main int  argc,
argv 
 

Definition at line 339 of file ftpd.c.

References alarm, args, cmd, fclose(), fflush(), fopen(), FTPD_LOG, FTPD_MSG, FtpdVersion, GetNetInfo(), GOOD, INACTIVITY_TIMEOUT, init, localtime(), logfile, logit(), msgfile, now, NULL, printf, readline(), s, SIGALRM, signal(), status, stdout, strcmp, time, time_t, tm::tm_hour, tm::tm_isdst, tm::tm_mday, tm::tm_min, tm::tm_mon, tm::tm_sec, tm::tm_wday, tm::tm_year, and tzname.

int readline char **  args  ) 
 

Definition at line 266 of file ftpd.c.

References BAD, cvtline(), getline(), and GOOD.

void showmsg char *  reply,
char *  filename
 

Definition at line 309 of file ftpd.c.

References fclose(), fgets(), fopen(), msgfile, NULL, printf, and strlen().

void Timeout int  sig  ) 
 

Definition at line 278 of file ftpd.c.

References printf.


Variable Documentation

char anonpass[128]
 

Definition at line 63 of file ftpd.c.

Referenced by doPASS().

int anonymous
 

Definition at line 61 of file ftpd.c.

Referenced by AreWeIn(), doDELE(), doMKD(), doRMD(), doRNFR(), doRNTO(), and recvfile().

struct commands commands[]
 

Definition at line 88 of file ftpd.c.

ipaddr_t dataaddr
 

Definition at line 66 of file ftpd.c.

Referenced by DataConnect().

tcpport_t dataport
 

Definition at line 67 of file ftpd.c.

Referenced by DataConnect(), and TalkTrans().

char* days[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}
 

Definition at line 53 of file ftpd.c.

Referenced by doSTAT(), httpdate(), httptime(), main(), Print_Duration(), Print_Uptime(), and september().

int format
 

Definition at line 59 of file ftpd.c.

int ftpdata_fd = -1
 

Definition at line 60 of file ftpd.c.

Referenced by DataConnect(), DOdata(), doPASV(), doPORT(), recvfile(), and sendfile().

char* FtpdVersion = "2.00"
 

Definition at line 24 of file ftpd.c.

Referenced by doSTAT(), and main().

int gotuser
 

Definition at line 61 of file ftpd.c.

Referenced by doPASS(), and doUSER().

char line[512]
 

Definition at line 57 of file ftpd.c.

FILE* logfile
 

Definition at line 74 of file ftpd.c.

Referenced by DataConnect(), doPASV(), get_cmd(), logging(), logit(), main(), outbyte(), recvfile(), and sendfile().

int loggedin
 

Definition at line 61 of file ftpd.c.

int mode
 

Definition at line 59 of file ftpd.c.

char* months[]
 

Initial value:

 {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
                  "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}

Definition at line 54 of file ftpd.c.

Referenced by doSTAT(), httpdate(), and httptime().

FILE* msgfile = (FILE *)NULL
 

Definition at line 48 of file ftpd.c.

Referenced by main(), and showmsg().

char myhostname[256]
 

Definition at line 69 of file ftpd.c.

Referenced by announce(), cgienv(), doSTAT(), GetNetInfo(), and sendreply().

ipaddr_t myipaddr
 

Definition at line 66 of file ftpd.c.

Referenced by doSTAT(), and GetNetInfo().

tcpport_t myport
 

Definition at line 67 of file ftpd.c.

Referenced by doSTAT(), and GetNetInfo().

char newroot[128]
 

Definition at line 64 of file ftpd.c.

Referenced by AreWeIn(), dochroot(), dosrvrroot(), and path().

char rmthostname[256]
 

Definition at line 69 of file ftpd.c.

Referenced by cgienv(), GetNetInfo(), main(), and proxy().

ipaddr_t rmtipaddr
 

Definition at line 66 of file ftpd.c.

Referenced by doPASV(), doSTAT(), and GetNetInfo().

tcpport_t rmtport
 

Definition at line 67 of file ftpd.c.

Referenced by doSTAT(), and GetNetInfo().

int structure
 

Definition at line 59 of file ftpd.c.

int timeout = 0
 

Definition at line 76 of file ftpd.c.

Referenced by DataConnect(), do_child(), do_select(), get_time(), main(), res_send(), select(), tcp_send_timeout(), and w_other().

int type
 

Definition at line 59 of file ftpd.c.

char username[80]
 

Definition at line 62 of file ftpd.c.

Referenced by AreWeIn(), doPASS(), doSTAT(), doUSER(), DOuser(), and get_homedir().


Generated on Fri Apr 14 23:03:30 2006 for minix by  doxygen 1.4.6