Beginning of FTP uploads
This commit is contained in:
parent
7e25a22a71
commit
6db36536ed
|
@ -48,11 +48,11 @@ Type
|
|||
Procedure Execute; Override;
|
||||
Destructor Destroy; Override;
|
||||
|
||||
Function OpenDataSession : Boolean;
|
||||
Procedure CloseDataSession;
|
||||
Procedure ResetSession;
|
||||
Procedure UpdateUserStats (TFBase: RecFileBase; FDir: RecFileList; DirPos: LongInt);
|
||||
Function CheckFileLimits (TempFBase: RecFileBase; FDir: RecFileList) : Byte;
|
||||
Function OpenDataSession : Boolean;
|
||||
Procedure CloseDataSession;
|
||||
Function ValidDirectory (TempBase: RecFileBase) : Boolean;
|
||||
Function FindDirectory (Var TempBase: RecFileBase) : LongInt;
|
||||
|
||||
|
@ -67,6 +67,7 @@ Type
|
|||
Procedure cmdLIST;
|
||||
Procedure cmdPWD;
|
||||
Procedure cmdRETR;
|
||||
Procedure cmdSTOR;
|
||||
Procedure cmdSTRU;
|
||||
Procedure cmdMODE;
|
||||
Procedure cmdSYST;
|
||||
|
@ -497,14 +498,17 @@ Begin
|
|||
If LoggedIn Then Begin
|
||||
If (Data = '/') or (Copy(Data, 1, 2) = '..') Then Begin
|
||||
FBasePos := -1;
|
||||
|
||||
Client.WriteLine(re_DirOkay + '"/"');
|
||||
|
||||
Exit;
|
||||
End;
|
||||
|
||||
TempPos := FindDirectory(TempBase);
|
||||
|
||||
If TempPos = -1 Then Begin
|
||||
If (TempPos = -1) Or Not ValidDirectory(TempBase) Then Begin
|
||||
Client.WriteLine(re_BadDir);
|
||||
|
||||
Exit;
|
||||
End;
|
||||
|
||||
|
@ -526,10 +530,10 @@ Begin
|
|||
If LoggedIn Then Begin
|
||||
TempPos := FindDirectory(TempBase);
|
||||
|
||||
If TempPos = -1 Then Begin
|
||||
If (TempPos = -1) Or Not ValidDirectory(TempBase) Then Begin
|
||||
OpenDataSession;
|
||||
CloseDataSession;
|
||||
// list files in root directory, so show nothing
|
||||
|
||||
Exit;
|
||||
End;
|
||||
|
||||
|
@ -608,6 +612,12 @@ Begin
|
|||
Exit;
|
||||
End;
|
||||
|
||||
If Not ValidDirectory(TempBase) Then Begin
|
||||
Client.WriteLine(re_BadCommand);
|
||||
|
||||
Exit;
|
||||
End;
|
||||
|
||||
OpenDataSession;
|
||||
|
||||
DirFile := TFileBuffer.Create(FileBufSize);
|
||||
|
@ -633,6 +643,38 @@ Begin
|
|||
Client.WriteLine(re_BadCommand);
|
||||
End;
|
||||
|
||||
Procedure TFTPServer.cmdSTOR;
|
||||
Var
|
||||
TempPos : LongInt;
|
||||
TempBase : RecFileBase;
|
||||
Begin
|
||||
If Not LoggedIn Then Begin
|
||||
Client.WriteLine(re_BadCommand);
|
||||
|
||||
Exit;
|
||||
End;
|
||||
|
||||
TempPos := FindDirectory(TempBase);
|
||||
|
||||
If (TempPos = -1) Or Not ValidDirectory(TempBase) Then Begin
|
||||
Client.WriteLine(re_BadFile);
|
||||
|
||||
Exit;
|
||||
End;
|
||||
|
||||
Client.WriteLine(re_BadFile);
|
||||
|
||||
//reasons why i haven't finished this (todo):
|
||||
|
||||
// ratios
|
||||
// diskspace
|
||||
// archive testing
|
||||
// file_id.diz importing
|
||||
// forcing uploads to upload base (if non-zero)
|
||||
// duplicate file checking
|
||||
// upload statistic tracking
|
||||
End;
|
||||
|
||||
Procedure TFTPServer.cmdRETR;
|
||||
Var
|
||||
TempPos : LongInt;
|
||||
|
@ -833,10 +875,11 @@ Begin
|
|||
If Cmd = 'PASS' Then cmdPASS Else
|
||||
If Cmd = 'PASV' Then cmdPASV Else
|
||||
If Cmd = 'PORT' Then cmdPORT Else
|
||||
If Cmd = 'PWD' Then cmdPWD ELse
|
||||
If Cmd = 'PWD' Then cmdPWD Else
|
||||
If Cmd = 'REIN' Then cmdREIN Else
|
||||
If Cmd = 'RETR' Then cmdRETR Else
|
||||
If Cmd = 'SIZE' Then cmdSIZE Else
|
||||
If Cmd = 'STOR' Then cmdSTOR Else
|
||||
If Cmd = 'STRU' Then cmdSTRU Else
|
||||
If Cmd = 'SYST' Then cmdSYST Else
|
||||
If Cmd = 'TYPE' Then cmdTYPE Else
|
||||
|
|
Loading…
Reference in New Issue